public void AddItem(Ware ware, int quantity) { CartLine line = lineCollection .Where(g => g.Ware.ID == ware.ID) .FirstOrDefault(); if (line == null) { lineCollection.Add(new CartLine { Ware = ware, Quantity = quantity }); } else { line.Quantity += quantity; } }
public void RemoveLine(Ware ware) { lineCollection.RemoveAll(l => l.Ware.ID == ware.ID); }