public ActionResult Delete(int departmentId) { if (DepartmentBO.GetById(departmentId) != null) { DepartmentBO.Delete(departmentId); return(RedirectToAction("Index")); } else { //ModelState.AddModelError("", "Có lỗi trong quá trình xóa"); return(RedirectToAction("NotFound", "Home")); } return(View()); }
public ActionResult Delete(int DepartmentId) { ResponseViewModel resp = new ResponseViewModel(); try { resp = DepartmentObject.Delete(DepartmentId); } catch (Exception ex) { resp.Success = false; resp.Message = ex.Message; } return(Json(resp, JsonRequestBehavior.AllowGet)); }