/// <summary> /// Initializes a new instance of the <see cref="OrderItem"/> class. /// </summary> /// <param name="index">The item index</param> /// <param name="quantity">The product quantity</param> /// <param name="price">The product price</param> /// <param name="product">The product being ordered</param> public OrderItem(int index, double quantity, decimal price, Product product) { this.ItemIndex = index; this.Quantity = quantity; this.Price = price; this.Product = product; }
/// <summary> /// Adds an item to the order /// </summary> /// <param name="quantity">The product quantity</param> /// <param name="price">The product price</param> /// <param name="product">The product being ordered</param> public virtual void AddItem(double quantity, decimal price, Product product) { var item = new OrderItem(this.items.Count + 1, quantity, price, product); this.items.Add(item); }