protected PaginatedResult <T> CreateResponse(ISmartSearchQueryRequest request, QueryResult <T> qr) { PaginatedResult <T> retVal = new PaginatedResult <T>() { Data = new List <T>() }; retVal.Data = qr.Data; retVal.TotalItems = qr.Statistics.TotalResults; retVal.TotalPages = retVal.TotalItems / request.PageSize; if ((retVal.TotalItems % request.PageSize) > 0) { retVal.TotalPages += 1; } retVal.PageSize = request.PageSize; retVal.CurrentPage = request.CurrentPage; return(retVal); }
static bool CurrentPageIsOverflown(PaginatedResult <T> result) => (result.Data.Count == 0) && (result.TotalPages > 0);