예제 #1
0
파일: Cart.cs 프로젝트: goodwin3000/Catalog
 public void Add(Product product,int quantity)
 {
     CartItem ct;
     ct = Items.Where(ci => ci.Product.ProductId == product.ProductId).SingleOrDefault();
     if ( ct== null)
     {
       ct  = new CartItem { Product = product, Quantity = quantity };
         Items.Add(ct);
     }
     else
     {
         ct.Quantity += quantity;
     }
 }
예제 #2
0
파일: Cart.cs 프로젝트: goodwin3000/Catalog
 public void Remove(Product product)
 {
     Items.RemoveAll(p => p.Product.ProductId == product.ProductId);
 }