public JsonResult GetDepartments(int page, int rows, string value = "") { var list = new DepSv().GetDepartments(value); int total = list.Count(); list = list.Skip((page - 1) * rows).Take(rows).ToList(); return(Json(new { rows = list, total = total })); }
public JsonResult RemoveDep(int depId) { string result = new DepSv().RemoveDepartment(depId); if (!string.IsNullOrEmpty(result)) { return(Json(new ResultModel() { suc = false, msg = result }, "text/html")); } return(Json(new ResultModel() { suc = true, msg = "删除成功" })); }
public JsonResult SaveDepartment(FormCollection col) { string depName = col.Get("depName"); string depType = col.Get("depType"); string result = new DepSv().SaveDepartment(depType, depName); if (!string.IsNullOrEmpty(result)) { return(Json(new ResultModel() { suc = false, msg = result }, "text/html")); } return(Json(new ResultModel() { suc = true }, "text/html")); }