public void AddItem(Product product, int quantity) { CartLine line = lineCollection.Where(m => m.Product.ProductID == product.ProductID).FirstOrDefault(); if (line!=null) { line.Quantity += quantity; } else { lineCollection.Add(new CartLine { Product = product, Quantity = quantity }); } }
public void RemoveLine(Product product) { lineCollection.RemoveAll(m => m.Product.ProductID == product.ProductID); }