public ActionResult ChangePwd(string oldPassword, string newPassword, string reNewPassword) { HttpCookie requestCookie = Request.Cookies["userInfo"]; int id = Convert.ToInt32(requestCookie["AccountID"]); if (string.IsNullOrEmpty(oldPassword)) { ModelState.AddModelError("OldPassword", "OldPassword is required"); } else { if (!AccountBLL.Account_CheckPass(oldPassword, id)) { ModelState.AddModelError("OldPassword", "Old password incorrect"); } ViewBag.OldPassword = oldPassword; } if (string.IsNullOrEmpty(newPassword)) { ModelState.AddModelError("NewPassword", "NewPassword is required"); } else { if (newPassword.Length < 6) { ModelState.AddModelError("NewPassword", "Password must over 6 characters"); } ViewBag.NewPassword = newPassword; } if (string.IsNullOrEmpty(reNewPassword)) { ModelState.AddModelError("ReNewPassword", "ReNewPassword is required"); } else { if (!newPassword.Equals(reNewPassword)) { ModelState.AddModelError("ReNewPassword", "The new password does not match the old password"); } ViewBag.ReNewPassword = reNewPassword; } if (!ModelState.IsValid) { return(View()); } if (AccountBLL.Account_ChangePwd(newPassword, id)) { return(RedirectToAction("SignOut")); } ModelState.AddModelError("error", "Cập nhật không thành công"); return(RedirectToAction("ChangePwd")); }