Ejemplo n.º 1
0
        public void AddItem(TProduct prod, int quantity)
        {
            CartLine line = lineCollection
                            .Where(g => g.Product.ID == prod.ID)
                            .FirstOrDefault();

            if (line == null)
            {
                lineCollection.Add(new CartLine
                {
                    Product  = prod,
                    Quantity = quantity
                });
            }
            else
            {
                line.Quantity += quantity;
            }
        }
Ejemplo n.º 2
0
 public void RemoveLine(TProduct product)
 {
     lineCollection.RemoveAll(l => l.Product.ID == product.ID);
 }