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)); } }