public object GetFile(DataTablesAjaxRequestModel tableModel) { int total = 0; int totalFiltered = 0; var records = _fileService.GetFiles( tableModel.PageIndex, tableModel.PageSize, tableModel.SearchText, out total, out totalFiltered); return(new { recordsTotal = total, recordsFiltered = totalFiltered, data = (from record in records select new string[] { record.Id.ToString(), record.FileName, record.FileUploadDate.ToString(), record.Status } ).ToArray() }); }
public object GetRoles(DataTablesAjaxRequestModel tableModel) { int total = 0; int totalFiltered = 0; var start = (tableModel.PageIndex - 1) * tableModel.PageSize; IEnumerable <IdentityRole> records = null; if (string.IsNullOrWhiteSpace(tableModel.SearchText)) { records = _roleManager.Roles.Skip(start).Take(tableModel.PageSize); } else { records = _roleManager.Roles.Where(x => x.Name.Contains(tableModel.SearchText)); } return(new { recordsTotal = total, recordsFiltered = totalFiltered, data = (from record in records select new string[] { record.Id.ToString(), record.Name, record.Id.ToString() } ).ToArray() }); }