public GridResults ApplyPaging <T>(IGridDataSource <T> source, GridDataRequest paging, List <EntityDTO> list) where T : DomainEntity { var recordCount = source.TotalCount(); var pageCount = (int)Math.Ceiling(recordCount / (double)paging.ResultsPerPage); if (pageCount < paging.Page) { paging.Page = pageCount; } return(new GridResults { page = paging.Page, records = recordCount, total = pageCount, items = list }); }
public int GetCount(IGridDataSource <TEntity> source) { applyRestrictions(source); return(source.TotalCount()); }