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