public ActionResult Profile(AccountProfileInputModel input) { if (ModelState.IsValid) { var result = this.accountAdapter.UpdateProfile( User.Identity.Name, input.FirstName, input.LastName, input.Email ); if (result.StatusCode == 200) { return View(new AccountProfileModel { Input = input, Message = "Profile information updated successfully" } ); } var error = result.Errors.First(); ModelState.AddModelError(error.MemberNames.First(), error.ErrorMessage); } return View(new AccountProfileModel { Input = input }); }
/// <summary> /// Get action for the profile page. /// </summary> /// <returns>A view with the profile page.</returns> public ActionResult Profile() { var user = this.accountAdapter.GetUser(User.Identity.Name); if (user.StatusCode != 200) return HttpNotFound(); AccountProfileInputModel input = new AccountProfileInputModel { FirstName = user.Result.FirstName, LastName = user.Result.LastName, Email = user.Result.Email }; return View(new AccountProfileModel() { Input = input }); }