public virtual ActionResult ChangePassword(string id) { var userModel = new UsercredentialsModel(); userModel.Id = id; return(View(userModel)); }
public virtual ActionResult ChangePassword(UsercredentialsModel usermodel) { var user = UserManager.FindById(usermodel.Id); if (user == null) { return(View("Error")); } user.PasswordHash = UserManager.PasswordHasher.HashPassword(usermodel.Password); var result = UserManager.Update(user); if (!result.Succeeded) { //throw exception...... } return(RedirectToAction("Index")); }