Пример #1
0
        public ActionResult Staff_ChangePassword(ChangPasswordModel model, string returnURL)
        {
            if (ModelState.IsValid)
            {
                string username = model.Username;
                string password = model.Password;
                string confirm  = model.ConfirmPassword;
                if (confirm.Equals(password))
                {
                    AccountDB accountDB = new AccountDB();
                    bool      check     = accountDB.ChangePass(username, password);
                    if (check)
                    {
                        TempData["alertMessage"] = "Success";
                        return(RedirectToAction("Staff_Product", "Staff"));
                    }
                    else
                    {
                        TempData["alertMessage"] = "Fail";
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Password must match Confirm");
                }
            }

            return(View());
        }