Пример #1
0
        public void AddItem(Sushi product, int quantity)
        {
            CartLine line = lineCollection
                            .Where(g => g.Product.SushiId == product.SushiId)
                            .FirstOrDefault();

            if (line == null)
            {
                lineCollection.Add(new CartLine
                {
                    Product  = product,
                    Quantity = quantity
                });
            }
            else
            {
                line.Quantity += quantity;
            }
        }
Пример #2
0
 public void RemoveLine(Sushi product)
 {
     lineCollection.RemoveAll(l => l.Product.SushiId == product.SushiId);
 }