public async Task<ActionResult> Manage(ManageViewModel mvm) { if(ModelState.IsValid) { var user = await userManager.GetUser(User.Identity.GetUserName()); user.AppUserData.Id = user.AppUser.Id; user.AppUserData.DisplayName = mvm.DisplayName; var ret = await userManager.UpdateUser(user.AppUserData); if (ret != 0) { if (!string.IsNullOrEmpty(mvm.OldPassword) && !string.IsNullOrEmpty(mvm.NewPassword) && mvm.NewPassword != mvm.OldPassword) { var retVal = await userManager.UpdatePassword(user.AppUser.Id, mvm.OldPassword, mvm.NewPassword); } var updatedUser = await userManager.GetUser(User.Identity.GetUserName()); mvm.DisplayName = updatedUser.AppUserData.DisplayName; } } return View(mvm); }
public async Task<ActionResult> Manage() { var usr = await userManager.GetUser(User.Identity.Name); var ret = new ManageViewModel(); ret.DisplayName = usr.AppUserData.DisplayName; return View(ret); }