Exemple #1
0
 public void AddItem(Product product, int quantity)
 {
     CartLine line = CartLineCollection.Where(p => p.Product.ProductId == product.ProductId)
                     .FirstOrDefault();
     if (line == null)
     {
         CartLineCollection.Add(new CartLine { Product = product, Quantity = quantity });
     }
     else
     {
         line.Quantity += quantity;
     }
 }
Exemple #2
0
 public void RemoveLine(Product product)
 {
     CartLineCollection.RemoveAll(p => p.Product.ProductId == product.ProductId);
 }