protected AboutMembersViewModel ToViewModel(GetAboutMembersQueryResult result) { AboutMembersViewModel vm = Mapper.Map <AboutMembersViewModel>(result); vm.Members1 = result.Members.Select(i => new SelectListItem { Value = i.Id, Text = i.FullName, Selected = i.Id == result.Member1Id }).ToList(); vm.Members2 = result.Members.Select(i => new SelectListItem { Value = i.Id, Text = i.FullName, Selected = i.Id == result.Member2Id }).ToList(); vm.Members3 = result.Members.Select(i => new SelectListItem { Value = i.Id, Text = i.FullName, Selected = i.Id == result.Member3Id }).ToList(); vm.Members4 = result.Members.Select(i => new SelectListItem { Value = i.Id, Text = i.FullName, Selected = i.Id == result.Member4Id }).ToList(); return(vm); }
public ActionResult Members() { GetAboutMembersQueryResult result = Query.For <GetAboutMembersQueryResult>().With(new EmptyCriterion()); AboutMembersViewModel vm = ToViewModel(result); return(View(vm)); }
public ActionResult Members(AboutMembersViewModel vm) { Command.Execute(new EditAboutMembersCommand { Members = ToModel(vm) }); return(RedirectToAction("Index")); }
protected AboutMembers ToModel(AboutMembersViewModel vm) { AboutMembers model = Mapper.Map <AboutMembers>(vm); return(model); }