public ActionResult Email(EmailViewModel model) { SetBreadCrumb("Email"); if (_userServices.EmailInUse(model.NewEmail)) ModelState.AddModelError("NewEmail", "This email is already in use by another user"); if (IsModelValidAndPersistErrors()) { CurrentUser.Email = model.NewEmail; _userServices.UpdateEmail(CurrentUser.UserID, model.NewEmail); SetSuccess("Email changed"); } return RedirectToSelf(); }
public ActionResult Email() { SetBreadCrumb("Email"); var model = new EmailViewModel() { CurrentEmail = CurrentUser.Email }; return View(model); }