`Update-Database` command created the `Books` table in the database. Open your database and enter a few sample rows, so you can show them on the page:
`Update-Database` command created the `AppBooks` table in the database. Open your database and enter a few sample rows, so you can show them on the page:
* Mapped `BookDto` (received from the `BookAppService.GetAsync`) to `CreateUpdateBookDto` in the `GetAsync` method.
* The `OnPostAsync` simply uses `BookAppService.UpdateAsync` to update the entity.
#### CreateUpdateBookDto
#### BookDto to CreateUpdateBookDto Mapping
In order to perform `BookDto` to `CreateUpdateBookDto` object mapping, change the `CreateUpdateBookDto` class as shown below:
In order to perform `BookDto` to `CreateUpdateBookDto` object mapping, open the `BookStoreWebAutoMapperProfile.cs` in the `Acme.BookStore.Web` project and change it as shown below:
````C#
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.AutoMapper;
````csharp
using AutoMapper;
namespace Acme.BookStore
namespace Acme.BookStore.Web
{
[AutoMapTo(typeof(Book))]
[AutoMapFrom(typeof(BookDto))]
public class CreateUpdateBookDto
public class BookStoreWebAutoMapperProfile : Profile
{
[Required]
[StringLength(128)]
public string Name { get; set; }
[Required]
public BookType Type { get; set; } = BookType.Undefined;
[Required]
public DateTime PublishDate { get; set; }
[Required]
public float Price { get; set; }
public BookStoreWebAutoMapperProfile()
{
CreateMap<BookDto,CreateUpdateBookDto>();
}
}
}
````
* Just added the `[AutoMapFrom(typeof(BookDto))]` attribute to create the mapping.
* Just added `CreateMap<BookDto, CreateUpdateBookDto>();` as the mapping definition.
#### EditModal.cshtml
@ -219,8 +207,8 @@ Replace `EditModal.cshtml` content with the following content: