Skip to content

Commit

Permalink
Merge pull request #670 from bcgov/yj
Browse files Browse the repository at this point in the history
Yj
  • Loading branch information
ychung-mot committed Sep 20, 2024
2 parents 041ba9b + 2d4373c commit 0986661
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion server/StrDss.Data/Repositories/RentalListingRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public async Task<PagedDto<RentalListingGroupDto>> GetGroupedRentalListings(stri
var extraSort = "";


var groupedListings = await Page<RentalListingGroupDto, RentalListingGroupDto>(groupedQuery, pageSize, pageNumber, orderBy, direction, extraSort);
var groupedListings = await Page<RentalListingGroupDto, RentalListingGroupDto>(groupedQuery, pageSize, pageNumber, orderBy, direction, extraSort, false);


foreach (var group in groupedListings.SourceList)
Expand Down
6 changes: 3 additions & 3 deletions server/StrDss.Data/Repositories/RepositoryBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace StrDss.Data.Repositories
public interface IRepositoryBase<TEntity>
where TEntity : class
{
Task<PagedDto<TOutput>> Page<TInput, TOutput>(IQueryable<TInput> list, int pageSize, int pageNumber, string orderBy, string direction, string extraSort = "");
Task<PagedDto<TOutput>> Page<TInput, TOutput>(IQueryable<TInput> list, int pageSize, int pageNumber, string orderBy, string direction, string extraSort = "", bool count = true);
}
public class RepositoryBase<TEntity> : IRepositoryBase<TEntity>
where TEntity : class
Expand All @@ -34,11 +34,11 @@ public RepositoryBase(DssDbContext dbContext, IMapper mapper, ICurrentUser curre
_logger = logger;
}

public async Task<PagedDto<TOutput>> Page<TInput, TOutput>(IQueryable<TInput> list, int pageSize, int pageNumber, string orderBy, string direction = "", string extraSort = "")
public async Task<PagedDto<TOutput>> Page<TInput, TOutput>(IQueryable<TInput> 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;

Expand Down

0 comments on commit 0986661

Please sign in to comment.