Beispiel #1
0
        public async Task Compute(SaleHeader saleHeader)
        {
            List <Beer> beers = (await _beerRepository.PricesListAsync(saleHeader.SaleLines.AsEnumerable().Select(x => x.BeerId).ToList())).ToList();

            foreach (SaleLine saleLine in saleHeader.SaleLines)
            {
                saleLine.UnitPrice = beers.AsEnumerable().Where(x => x.Id == saleLine.BeerId).First().Price;
            }

            saleHeader.Compute();
        }
Beispiel #2
0
        public void Create(SaleHeader saleHeader)
        {
            saleHeader.Compute();

            _context.Sales.Add(saleHeader);
        }