private async Task <List <ProductPrice> > FillProductPrices(int catId, DateTime dateFrom, DateTime dateTo) { var payingItems = await _payingItemService .GetListAsync(x => x.CategoryID == catId && x.Date >= dateFrom.Date && x.Date <= dateTo.Date) .ConfigureAwait(false); var productPrices = payingItems.ToList() .SelectMany(x => x.PayingItemProducts) .GroupBy(x => x.Product.ProductName) .Select(x => new ProductPrice() { ProductName = x.Key, Price = x.Sum(p => p.Price) }) .ToList(); return(productPrices); }
public async Task <IEnumerable <PayingItem> > GetListAsync() { return(await _payingItemService.GetListAsync()); }