public void AddToShoppingCart(WebshopItem webshopItem) { DisplayOrderLine o = Cart.OrderLines.FirstOrDefault(ol => ol.Consumable.ConsumableId == webshopItem.Consumable.ConsumableId); if (o == null) { if (webshopItem.Amount > 0) { Cart.OrderLines.Add(new DisplayOrderLine(webshopItem.Amount, webshopItem.Consumable, Cart)); } } else { o.Amount += webshopItem.Amount; } webshopItem.ResetAmount(); }
public OrderLineDTO(DisplayOrderLine displayOrderLine) { Amount = displayOrderLine.Amount; ConsumableDTO = new ConsumableDTO(displayOrderLine.Consumable); }
public void RemoveItemFromCart(DisplayOrderLine orderLine) { Cart.OrderLines.Remove(orderLine); }