Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public ActionResult Members()
        {
            GetAboutMembersQueryResult result = Query.For <GetAboutMembersQueryResult>().With(new EmptyCriterion());
            AboutMembersViewModel      vm     = ToViewModel(result);

            return(View(vm));
        }
Esempio n. 3
0
        public ActionResult Members(AboutMembersViewModel vm)
        {
            Command.Execute(new EditAboutMembersCommand
            {
                Members = ToModel(vm)
            });

            return(RedirectToAction("Index"));
        }
Esempio n. 4
0
        protected AboutMembers ToModel(AboutMembersViewModel vm)
        {
            AboutMembers model = Mapper.Map <AboutMembers>(vm);

            return(model);
        }