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; } }
public void RemoveLine(ComputerComponent component) { lineCollection.RemoveAll(l => l.ComputerComponent.ComputerComponentId == component.ComputerComponentId); }