public Procurement Create(ProcurementModel model) { return(new Procurement() { Id = model.Id, Quantity = model.Quantity, Price = model.Price, Date = model.Date, Document = model.Document, Product = _unitOfWork.Products.Get(model.Product.Id), Supplier = _unitOfWork.Suppliers.Get(model.Supplier.Id) }); }
public ProcurementModel Create(Procurement procurement) { ProcurementModel model = new ProcurementModel() { Id = procurement.Id, Quantity = procurement.Quantity, Price = Math.Round(procurement.Price, 2), Date = procurement.Date, Document = procurement.Document, Product = new ProcurementModel.ProcurementProduct() { Id = procurement.Product.Id, Name = procurement.Product.Name }, Supplier = new ProcurementModel.ProcurementSupplier() { Id = procurement.Supplier.Id, Name = procurement.Supplier.Name } }; return(model); }