コード例 #1
0
        public ActionResult Save(MemberViewModel viewModel)
        {
            if (this.ModelState.IsValid)
            {
                Member member = this._membershipService.GetMemberById(viewModel.MemberId);

                if (member == null)
                {
                    member = new Member();
                    member.UpdatePassword(viewModel.Password.Password);
                }

                member.FirstName = viewModel.FirstName;
                member.LastName = viewModel.LastName;
                member.Company = viewModel.Company;
                member.Phone = viewModel.Phone;
                member.Email = viewModel.Email;
                member.Username = viewModel.Username;
                member.Roles = viewModel.SelectedRoles;

                this._membershipService.SaveMember(member);

                return this.RedirectToRoute(AdminRoutes.Membership.Edit, new { saved = true });
            }

            return this.Edit(viewModel.MemberId);
        }
コード例 #2
0
        public ActionResult Edit(int memberId, bool? saved = null)
        {
            Member member = this._membershipService.GetMemberById(memberId);

            MemberViewModel viewModel = new MemberViewModel(member);

            ViewBag.Saved = saved;

            return this.View("Edit", viewModel);
        }
コード例 #3
0
        public ActionResult Add()
        {
            MemberViewModel viewModel = new MemberViewModel();

            return this.View("Edit", viewModel);
        }