Ejemplo n.º 1
0
        private void StoreProductsInSoldTable(BuyArguments args)
        {
            var productsInStore = this.goodsTableRepository.FindProductsByRequest(args);

            foreach (var arg in args.ItemsToBuy)
            {
                var product = productsInStore.First(f => f.Name == arg.Name);

                var productInSoldGoods = new SoldGoodsTableEntity()
                {
                    Id           = product.Id,
                    Count        = arg.Count,
                    PricePerItem = product.PricePerItem,
                    Name         = product.Name,
                    SupplierId   = product.SupplierId
                };

                this.soldGoodsTableRepository.Add(productInSoldGoods);
            }

            this.soldGoodsTableRepository.SaveChanges();
        }
 public void Add(SoldGoodsTableEntity productEntity)
 {
     this.dbContext.SoldGoods.Add(productEntity);
 }