public virtual void add(Product product_to_add, int quantity_of_product) { if (contains_item_for(product_to_add)) { get_item_for(product_to_add).increment_quantity_by(quantity_of_product); return; } items.Add(item_factory.create_item_for(product_to_add, quantity_of_product)); }
public void add(Product product) { if (already_contains_item_for(product)) { get_item_for(product).increment_quantity(); return; } shopping_cart_items.Add(cart_item_factory.create_from(product)); }
public virtual void add(Product product, int quantity) { if (contains_item_for(product)) { get_item_for(product).increment_quantity_by(quantity); return; } items.Add(cart_item_factory.create_item_for(product, quantity)); }
public virtual void add(Product product_to_add, int quantity_of_product) { if( list_of_products.ContainsKey(product_to_add)) { list_of_products[product_to_add] += quantity_of_product; } else { list_of_products.Add(product_to_add,quantity_of_product); } }
public void remove(Product product) { shopping_cart_items.Remove(get_item_for(product)); }
bool already_contains_item_for(Product product) { return shopping_cart_items.Any(item => item.is_item_for(product)); }
ShoppingCartItem get_item_for(Product product) { return shopping_cart_items.FirstOrDefault(item => item.is_item_for(product)) ?? new MissingCartItem(); }
public virtual void modify(Product modified, int quantity) { Console.WriteLine("quantity" + quantity ); if( quantity == 0) remove(modified); }
public void Add(Product item) { itemsInChart.Add(item); }
public ShoppingCartItem(Product product, int quantity) { this.product = product; this.quantity = quantity; }
public virtual bool is_item_for(Product product) { throw new NotImplementedException(); }
public void remove(Product product) { items.Remove(get_item_for(product)); }
bool contains_item_for(Product product) { return items.Any(item => item.is_item_for(product)); }
public virtual void change_quantity(Product product, int new_quantity) { get_item_for(product).change_quantity_to(new_quantity); }
CartItem get_item_for(Product product_to_add) { return items.First(item => item.is_item_for(product_to_add)); }
public void change_quantity(Product product, int new_quantity) { var item = get_item_for(product); item.change_quantity_to(new_quantity); if (item.is_empty()) shopping_cart_items.Remove(item); }
public override bool is_item_for(Product product) { return false; }
public virtual bool is_item_for(Product product) { return this.product == product; }
public void delete_product_in_cart(Product remove) { throw new NotImplementedException(); }
public void delete_product_in_cart(Product product) { cart_corral.get_cart().remove( product); }
public virtual void remove(Product product_to_remove) { list_of_products.Remove(product_to_remove); }
public virtual ShoppingCartItem create_from(Product product) { throw new NotImplementedException(); }