public void AddLineItem(PurchaseOrderLineItem item) { if (!IsInBudget(item)) { throw new InvalidOperationException("Item exceeds budget"); } LineItems.Add(item); }
public bool IsInBudget(PurchaseOrderLineItem item) { return(item.Total + TotalSpent <= MaxValue); }