예제 #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;
     }
 }
예제 #2
0
 public void RemoveLine(Product product)
 {
     CartLineCollection.RemoveAll(p => p.Product.ProductId == product.ProductId);
 }