public static Business.PurchaseOrder ConvertToBO(DTO.v2.PurchaseOrder purchaseOrder) { var retval = new Business.PurchaseOrder { CustomerId = purchaseOrder.CustomerId, PurchaseOrderId = purchaseOrder.PurchaseOrderId, OrderDate = purchaseOrder.OrderDate }; foreach (var lineItem in purchaseOrder.LineItems) { // Probably want some validation logic around the Price to make // sure callers aren't changing this too... var boLineItem = new Business.LineItem { ItemId = lineItem.ItemId, Line = lineItem.Line, Price = lineItem.Price, PurchaseOrderId = retval.PurchaseOrderId, Qty = lineItem.Quantity }; retval.LineItems.Add(boLineItem); } return(retval); }
public bool Submit(DTO.v2.PurchaseOrder purchaseOrder) { var businessObject = ConvertToBO(purchaseOrder); return(businessObject.Submit()); }