public async Task<ActionResult> EditProfile(EditProfileViewModel model) { if (!ModelState.IsValid) { return View(model); } var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); user.RealName = model.DisplayName; user.Email = model.Email; user.UserName = model.UserName; var result = await UserManager.UpdateAsync(user); if (result.Succeeded) { return RedirectToAction("Index", new { Message = ManageMessageId.EditProfileSuccess }); } AddErrors(result); return View(model); }
public async Task<ActionResult> EditProfile() { var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); var model = new EditProfileViewModel { DisplayName = user.RealName, Email = user.Email, UserName = user.UserName }; return View(model); }