示例#1
0
        public ActionResult Add(StaffActionView model)
        {
            try
            {
                HttpCookie         reqCookies = Request.Cookies["StaffLoginCookie"];
                ResponseStaffLogin login      = JsonConvert.DeserializeObject <ResponseStaffLogin>(reqCookies.Value.ToString().UrlDecode());

                if (ModelState.IsValid)
                {
                    if (_staffBusiness.CheckExistsAccount(model.Account, 0))
                    {
                        ModelState.AddModelError("ExistsAccountError", "Tài khoản này đã tồn tại trong hệ thống");
                        return(View(model));
                    }
                    model.CreateBy = login.Account;
                    if (_staffBusiness.Add(model))
                    {
                        _staffBusiness.Save();
                        return(Redirect("/Staff/List"));
                    }
                }
                return(View(model));
            }
            catch (Exception)
            {
                return(View(model));
            }
        }
示例#2
0
 public ActionResult ChangePass(ChangePassView model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (_staffBusiness.ChangePass(model))
             {
                 _staffBusiness.Save();
                 return(Redirect("/Dashboard/Dashboard"));
             }
         }
         return(View());
     }
     catch (Exception)
     {
         return(View());
     }
 }