Skip to content

Instantly share code, notes, and snippets.

@gmartinezsan
Created April 17, 2018 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmartinezsan/e508fbecd5ce118f8c0e63b400a7c29e to your computer and use it in GitHub Desktop.
Save gmartinezsan/e508fbecd5ce118f8c0e63b400a7c29e to your computer and use it in GitHub Desktop.
using BooksWebApi.Entities;
using AutoMapper;
namespace BooksWebApi.Models
{
public class CategoryMappingProfile : Profile
{
public CategoryMappingProfile()
{
CreateMap<Category, CategoryModel>().ForMember(a => a.Books, opt => opt.ResolveUsing(c => c.Books))
.ReverseMap();
CreateMap<Book, BookWithoutCategoryModel>()
.ReverseMap();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment