public async Task <ActionResult> UpdatePassword(UpdatePasswordViewModel model, string userId, string newPassword) { SWGDealerDbContext context = new SWGDealerDbContext(); UserStore <AppUser> store = new UserStore <AppUser>(context); UserManager <AppUser> userManager = new UserManager <AppUser>(store); userId = User.Identity.GetUserId(); if (!ModelState.IsValid) { return(View("UpdatePassword")); } else { newPassword = model.ConfirmPassword; string hashedNewPassword = userManager.PasswordHasher.HashPassword(newPassword); AppUser identityUser = await store.FindByIdAsync(userId); await store.SetPasswordHashAsync(identityUser, hashedNewPassword); await store.UpdateAsync(identityUser); TempData["PasswordUpdate"] = "Password has been successfully updated!"; return(View("UpdatePassword")); } }