public virtual void AddItem(string productName, decimal price, int quantity) { if (price < 0) throw new ArgumentException("Price can't be negative"); var shopOrderItem = new ShopOrderItem { ProductName = productName, Price = price, Quantity = quantity }; this.AddItem(shopOrderItem); }
public virtual void AddItem(ShopOrderItem shopOrderItem) { this.ShopOrderItems.Add(shopOrderItem); shopOrderItem.ShopOrder = this; }