public void AddItem(ElectronicCigarettes cigarettes, int quantity) { CartLine line = lineCollection .Where(c => c.ElectronicCigarettes.ElectronicCigarettesId == cigarettes.ElectronicCigarettesId) .FirstOrDefault(); if (line == null) { lineCollection.Add(new CartLine { ElectronicCigarettes = cigarettes, Quantity = quantity }); } else { line.Quantity += quantity; } }
public void RemoveLine(ElectronicCigarettes cigarettes) { lineCollection.RemoveAll(l => l.ElectronicCigarettes.ElectronicCigarettesId == cigarettes.ElectronicCigarettesId); }