public JsonResult LoadData(int type, string keyword, int pageIndex, int pageSize) { string str = NonUnicode.RemoveUnicode(keyword).ToLower(); var model = new RoleDao().ListAll(); switch (type) { case 0: model = model.Where(x => NonUnicode.RemoveUnicode(x.Name).ToLower().Contains(str)); break; case 1: model = model.Where(x => NonUnicode.RemoveUnicode(x.Name).ToLower().Contains(str)); break; } int totalRow = model.Count(); model = model.OrderByDescending(x => x.ID) .Skip((pageIndex - 1) * pageSize) .Take(pageSize); int totalRowCurent = model.Count(); return(Json(new { data = model, total = totalRow, totalCurent = totalRowCurent, status = true }, JsonRequestBehavior.AllowGet)); }