Skip to content

Instantly share code, notes, and snippets.

@codereflection
Created October 10, 2010 20:38
Show Gist options
  • Select an option

  • Save codereflection/619544 to your computer and use it in GitHub Desktop.

Select an option

Save codereflection/619544 to your computer and use it in GitHub Desktop.
public static IMappingExpression<Procurement, ProcurementViewModel> CreateDestinationMap()
{
return Mapper.CreateMap<Procurement, ProcurementViewModel>()
.ForMember(dest => dest.Id, opt => opt.MapFrom(p => p.Procurement_ID))
.ForMember(dest => dest.Donors,
opt => opt.MapFrom(p =>
Mapper.Map<IEnumerable<Donor>, IEnumerable<ProcurementDonorViewModel>>(p.ProcurementDonors.Select(x => x.Donor))
));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment