Created
August 30, 2013 08:41
-
-
Save JoachimL/6387662 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
namespace WebApi.OData | |
{ | |
public class DomainToModelMappingProfile : Profile | |
{ | |
public DomainToModelMappingProfile() | |
{ | |
Mapper.CreateMap<Movie, MoviePresentationModel>() | |
.ForMember(m => m.YearOfRelease, x => x.MapFrom(y => y.Released.Year)) | |
.ForMember(m => m.AverageRating, x => x.MapFrom(y => y.Ratings.Average(r => r.Rating))) | |
.ForMember(m => m.Actors, x => x.MapFrom(y => y.Actors.Select(a => a.Name))); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment