Exemple #1
0
        public ShoppingCart AddItem(int quantity, Product product)
        {
            var existingItem = (from i in Items where i.Product.Id == product.Id select i).SingleOrDefault();
            if (existingItem != null)
            {
                existingItem.Quantity++;
                return this;
            }

            // Create new item
            Items.Add(ShoppingCartItem.Create(quantity, product));
            return this;
        }
Exemple #2
0
 public static ShoppingCartItem Create(int quantity, Product product)
 {
     var item = new ShoppingCartItem {Quantity = quantity, Product = product};
     return item;
 }
Exemple #3
0
 public static OrderItem CreateNewForOrder(Order order, int quantity, Product product)
 {
     var item = new OrderItem { Quantity = quantity, Product = product, Order = order };
     return item;
 }
Exemple #4
0
 public bool Delete(Product aggregate)
 {
     throw new System.NotImplementedException();
 }