public ActionResult PasswordReset(string email, string oldPassword, string newPassword) { logics = new GeneralLogics(); businessLogics = new BusinessLogics(); var result = businessLogics.FindAccountByEmail(email); if (result != null) { if (result.Password == oldPassword) { if (oldPassword == newPassword) { ViewBag.ErrorMsg = "Old Password can't be your new password"; } else { result.Password = newPassword; var newResult = businessLogics.ChangePassword(result); if (newResult == 1) { return(RedirectToAction("Logout", "Authentication")); } else if (newResult == 0) { ViewBag.ErrorMsg = "Internal Error occured. Failed to change tha password"; } else { ViewBag.ErrorMsg = "Error occured while changing Password"; } } } else { ViewBag.ErrorMsg = "Please enter your valid old Password"; } } return(View()); }