public void add(Item item, int quantity) { totalPrice += item.price * quantity; totalQuantity += quantity; foreach(CartItem i in items) { if(i.item.ID == item.ID) { i.quantity += quantity; i.totalPrice += item.price * quantity; return; } } items.Add(new CartItem(item, quantity)); }
public CartItem(Item item, int quantity) { this.item = item; this.quantity = quantity; this.totalPrice = item.price * quantity; }
public OrderLine(int ID, Item item, int quantity) { this.ID = ID; this.item = item; this.quantity = quantity; }