public void AddItem(Hsuit hsuit, int quantity) { CartLine line = lineCollection. Where(h => h.Hsuit.Id == hsuit.Id). FirstOrDefault(); if (line == null) { lineCollection.Add(new CartLine { Hsuit = hsuit, Quantity = quantity }); } else { line.Quantity += quantity; } }
public void RemoveLine(Hsuit hsuit) { lineCollection.RemoveAll(l => l.Hsuit.Id == hsuit.Id); }