Beispiel #1
0
        public void AddItem(ComputerComponent component, int quantity)
        {
            CartLine line = lineCollection
                            .Where(g => g.ComputerComponent.ComputerComponentId == component.ComputerComponentId)
                            .FirstOrDefault();

            if (line == null)
            {
                lineCollection.Add(new CartLine
                {
                    ComputerComponent = component,
                    Quantity          = quantity
                });
            }
            else
            {
                line.Quantity += quantity;
            }
        }
Beispiel #2
0
 public void RemoveLine(ComputerComponent component)
 {
     lineCollection.RemoveAll(l => l.ComputerComponent.ComputerComponentId == component.ComputerComponentId);
 }