public bool AddItem(Product product, double orderQuantity) { if (HasCouponApplied || HasCampaignsApplied) { return(false); //You cannot add a product in cart after applying campaign or coupon } if (product == null || orderQuantity <= 0) { return(false); //Invalid item to add } if (CartItems.ContainsKey(product.Title)) { CartItems[product.Title] = CartItems[product.Title].AddQuantity(orderQuantity); } else { CartItems.Add(product.Title, new ShoppingCartItem(product, orderQuantity)); } return(true); }