public static SupplierProductDTO SupplierProductToDto(SupplierProduct c) { SupplierProductDTO dto = new SupplierProductDTO() { Id = c.ConditionId, AverageLeadTime = c.AverageLeadTimeInDays, LastReceiptCost = c.LastReceiptCost, LastReceiptDate = c.LastReceiptDate, MaxOrderQuantity = c.MaxOrderQuantity, MinOrderQuantity = c.MinOrderQuantity, StandardPrice = c.StandardPrice, ProductId = c.Product.ProductId, ProductName = c.Product.Name, Version = c.Version }; return(dto); }
public static SupplierProduct DtoToSupplierProduct(SupplierProductDTO dto, Supplier supplier) { SupplierProduct supplierProduct = new SupplierProduct { ConditionId = dto.Id, AverageLeadTimeInDays = dto.AverageLeadTime, LastReceiptCost = dto.LastReceiptCost, LastReceiptDate = dto.LastReceiptDate, MaxOrderQuantity = dto.MaxOrderQuantity, MinOrderQuantity = dto.MinOrderQuantity, StandardPrice = dto.StandardPrice, Supplier = supplier, Version = dto.Version, Product = new Product { ProductId = dto.ProductId } }; ValidationHelper.Validate(supplierProduct); return(supplierProduct); }