public async Task <PagedCollection <GetPaymentHistoryDto> > GetListByFilterParamsAsync(PaymentHistoryFilterParams filterParams, CancellationToken ct = default)
        {
            _logger.LogInformation("Get payment histories by filter params {@FilterParams}", filterParams);

            var items = await _unitOfWork.PaymentHistoryRepository.GetListByAccountIdAsync(filterParams, ct);

            var result = new PagedCollection <GetPaymentHistoryDto>(
                _mapper.Map <IEnumerable <GetPaymentHistoryDto> >(items.Items), items.TotalCount);

            return(result);
        }
Exemplo n.º 2
0
        public async Task <PagedCollection <PaymentHistory> > GetListByAccountIdAsync(PaymentHistoryFilterParams filterParams, CancellationToken ct)
        {
            var query = DbSet.AsNoTracking().AsQueryable();

            int totalCount = query.Count();

            var items = await query
                        .Where(q => q.AccountId == filterParams.AccountId)
                        .Skip(filterParams.PageSize * (filterParams.PageNumber - 1))
                        .Take(filterParams.PageSize)
                        .AsNoTracking()
                        .ToListAsync(ct);

            return(new PagedCollection <PaymentHistory>(items.ToImmutableList(), totalCount));
        }