Guest User

Untitled

a guest
Jul 20th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. //This is sample code from the rewrite of my blog.
  2.  
  3. ## This is what the mapping would look like
  4. Mapper.CreateMap<BasicPostInfo, SelectListItem>()
  5. .ForMember(dest => dest.Text, opt => opt.MapFrom(src => src.Title))
  6. .ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.Id));
  7.  
  8. ## The execution in the controller.
  9. var vm = new BlogManageViewModel();
  10. vm.DraftPosts = Mapper.Map<List<BasicPostInfo>, List<SelectListItem>>(basicPostInfoData.GetDraftPosts(group.Id));
Add Comment
Please, Sign In to add comment