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