public IActionResult _Index(string searchName, int page, int pageSize = 3) { var model = new Object(); int totalRow = 0; if (string.IsNullOrEmpty(searchName)) { model = _courseCategoryService.GetPaging(null, out totalRow, page, pageSize, x => x.Id). Select(m => new { m.Id, m.Name, m.SortOrder, m.Status }).ToList(); } else { model = _courseCategoryService.GetPaging(m => m.Name.Contains(searchName), out totalRow, page, pageSize, x => x.Id). Select(m => new { m.Id, m.Name, m.SortOrder, m.Status }).ToList(); } return(Json(new { data = model, total = totalRow, status = true })); }