Example #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;
        }
Example #2
0
 public static ShoppingCartItem Create(int quantity, Product product)
 {
     var item = new ShoppingCartItem {Quantity = quantity, Product = product};
     return item;
 }
Example #3
0
 public static OrderItem CreateNewForOrder(Order order, int quantity, Product product)
 {
     var item = new OrderItem { Quantity = quantity, Product = product, Order = order };
     return item;
 }
Example #4
0
 public bool Delete(Product aggregate)
 {
     throw new System.NotImplementedException();
 }