diff --git a/server/StrDss.Data/Repositories/RentalListingRepository.cs b/server/StrDss.Data/Repositories/RentalListingRepository.cs index 78016832..74a3c4c9 100644 --- a/server/StrDss.Data/Repositories/RentalListingRepository.cs +++ b/server/StrDss.Data/Repositories/RentalListingRepository.cs @@ -109,7 +109,7 @@ public async Task> GetGroupedRentalListings(stri var extraSort = ""; - var groupedListings = await Page(groupedQuery, pageSize, pageNumber, orderBy, direction, extraSort); + var groupedListings = await Page(groupedQuery, pageSize, pageNumber, orderBy, direction, extraSort, false); foreach (var group in groupedListings.SourceList) diff --git a/server/StrDss.Data/Repositories/RepositoryBase.cs b/server/StrDss.Data/Repositories/RepositoryBase.cs index e1d39601..1f3a67f4 100644 --- a/server/StrDss.Data/Repositories/RepositoryBase.cs +++ b/server/StrDss.Data/Repositories/RepositoryBase.cs @@ -11,7 +11,7 @@ namespace StrDss.Data.Repositories public interface IRepositoryBase where TEntity : class { - Task> Page(IQueryable list, int pageSize, int pageNumber, string orderBy, string direction, string extraSort = ""); + Task> Page(IQueryable list, int pageSize, int pageNumber, string orderBy, string direction, string extraSort = "", bool count = true); } public class RepositoryBase : IRepositoryBase where TEntity : class @@ -34,11 +34,11 @@ public RepositoryBase(DssDbContext dbContext, IMapper mapper, ICurrentUser curre _logger = logger; } - public async Task> Page(IQueryable list, int pageSize, int pageNumber, string orderBy, string direction = "", string extraSort = "") + public async Task> Page(IQueryable list, int pageSize, int pageNumber, string orderBy, string direction = "", string extraSort = "", bool count = true) { var stopwatch = Stopwatch.StartNew(); - var totalRecords = list.Count(); + var totalRecords = await list.CountAsync(); if (pageNumber <= 0) pageNumber = 1;