public ActionResult ResetPasswordCodeValidation(NewPasswordModel model) { var message = ""; TestDatabaseEntities context = new TestDatabaseEntities(); if (model.ResetCode != null) { string newPassword = Crypto.Hash(model.NewPassword); context.ChangePassword(newPassword, model.ResetCode); message = "Password successfully changed"; ViewBag.Message = message; return(RedirectToAction("ProfilePage")); } else { message = "Something went wrong. Redirecting to login page. Please contact support."; ViewBag.Message = message; return(RedirectToAction("Login")); } }