Created
February 4, 2019 22:34
-
-
Save evgomes/e1594501f7072d4a1dd785962af8da17 to your computer and use it in GitHub Desktop.
ModelToResourceProfile with product mapping, of Supermarket API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using AutoMapper; | |
using Supermarket.API.Domain.Models; | |
using Supermarket.API.Extensions; | |
using Supermarket.API.Resources; | |
namespace Supermarket.API.Mapping | |
{ | |
public class ModelToResourceProfile : Profile | |
{ | |
public ModelToResourceProfile() | |
{ | |
CreateMap<Category, CategoryResource>(); | |
CreateMap<Product, ProductResource>() | |
.ForMember(src => src.UnitOfMeasurement, | |
opt => opt.MapFrom(src => src.UnitOfMeasurement.ToDescriptionString())); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment