public void Create(SalesOrder.Models.SalesOrder salesOrder) { var salesOrderEntity = new SalesOrderEntity() { ProductCode = salesOrder.ProductCode, Quantity = salesOrder.Quantity, Reference = salesOrder.Reference, UnitPrice = salesOrder.UnitPrice }; _salesOrderRepository.Create(salesOrderEntity); }
public void AddSalesOrder(Action <DocumentAssembler> document) { var documentAssembler = new DocumentAssembler(); document(documentAssembler); _currentDocId++; var items = documentAssembler.DocumentItemAssemblers; var salesOrderItems = new List <SalesOrderItemEntity>(); foreach (var item in items) { var prodId = _productsTable.Get(item.Name); salesOrderItems.Add( new SalesOrderItemEntity() { ProductInfo = prodId.Info, ProductName = item.Name, Price = item.Price, Quantity = item.Quantity, Value = item.Price * item.Quantity }); } var salesOrderEntity = new SalesOrderEntity() { Id = _currentDocId, Items = salesOrderItems, Value = salesOrderItems.Sum(x => x.Value) }; SalesOrderEntities.Add(salesOrderEntity.Id); _mocks.SalesOrderRepository.Get(salesOrderEntity.Id).Returns(salesOrderEntity); }
public void Create(SalesOrderEntity salesOrderEntity) { _salesOrderContext.Add(salesOrderEntity); _salesOrderContext.SaveChanges(); }