示例#1
0
        public async Task <IEnumerable <SaleDto> > GetFilteredByPageAndQty(SaleFiltersDto filtersDto, int skip, int qty)
        {
            var sales = (await _saleRepository.GetAll(x => x.Include(s => s.Client).Include(s => s.Payment).Include(s => s.Details).ThenInclude(d => d.Product)))
                        .AsQueryable().Where(filtersDto.GetExpresion()).ToList().OrderByDescending(x => x.Date).Skip(skip).Take(qty);

            foreach (var sale in sales)
            {
                sale.Details = sale.Details.Where(x => !x.IsDeleted).ToList();
            }
            var salesDto = _mapper.Map <IEnumerable <Sale>, IEnumerable <SaleDto> >(sales);

            return(await SetSalePayments(sales, salesDto));
        }
示例#2
0
 public async Task <int> GetTotalQtyByFilters(SaleFiltersDto filtersDto)
 {
     return((await _saleRepository.GetAll(x => x.Include(s => s.Details).ThenInclude(d => d.Product))).AsQueryable().Where(filtersDto.GetExpresion()).Count());
 }