コード例 #1
0
        public ActionResult NewAcc(CustomerinfoViewModel cus)
        {
            ss.Update(cus);
            List <CustomerinfoViewModel> c = ss.GetAll();

            Session["AllListAcc"] = c;
            if (Session["cusSearch"] == null)
            {
                return(RedirectToAction("ViewAllAcc"));
            }
            return(RedirectToAction("AccSearch"));
        }
コード例 #2
0
        public ActionResult UpdatePassword()
        {
            int    id                      = (int)Session["id"];
            string oldPassword             = Request.Params["oldPassword"];
            string newPassword             = Request.Params["newPassword"];
            string reNewPassword           = Request.Params["reNewPassword"];
            CustomerinfoDAORequest request = new CustomerinfoDAORequest();
            var customer                   = request.GetCustomerById(id);

            if (!CheckNullField(oldPassword, newPassword, reNewPassword))
            {
                if (CheckOldPassword(customer.password, oldPassword))
                {
                    if (CheckMatchNewPassword(newPassword, reNewPassword))
                    {
                        customer.password = PasswordSecurity.Encrypt(newPassword);
                        request.Update(customer);
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        TempData["Alert"] = "New password not match";
                        return(RedirectToAction("ChangePassword"));
                    }
                }
                else
                {
                    TempData["Alert"] = "Old Password is not corrent";
                    return(RedirectToAction("ChangePassword"));
                }
            }
            else
            {
                TempData["Alert"] = "Please Enter All Of Field";
                return(RedirectToAction("ChangePassword"));
            }
        }