コード例 #1
0
 public ActionResult Edit(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, model.ID))
             {
                 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.Edit(model))
             {
                 _staffBusiness.Save();
                 return(Redirect("/Staff/List"));
             }
         }
         return(View(model));
     }
     catch (Exception)
     {
         return(View(model));
     }
 }