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); }
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); }
public ActionResult Add() { MemberViewModel viewModel = new MemberViewModel(); return this.View("Edit", viewModel); }