private void StoreProductsInSaleHistoryTable(BuyArguments args) { var productsInStore = this.goodsTableRepository.FindProductsByRequest(args); foreach (var arg in args.ItemsToBuy) { var product = productsInStore.First(f => f.Name == arg.Name); var productInSaleHistory = new SaleHistoryTableEntity() { Id = product.Id, Count = arg.Count, PricePerItem = product.PricePerItem, Name = product.Name, SupplierId = product.SupplierId }; this.saleHistoryTableRepository.Add(productInSaleHistory); } this.saleHistoryTableRepository.SaveChanges(); }
public void Add(SaleHistoryTableEntity productEntity) { this.dbContext.SaleHistory.Add(productEntity); }