Example #1
0
		public void Handle(AddProductToCart productToCart)
		{
			var cart = _cartRootRepository.Find(productToCart.Id);
			if( null == cart )
			{
				cart = Cart.Create(productToCart.Id);
			}
			var product = _productRootRepository.Get(productToCart.ProductId);
			cart.AddProduct(product);
		}
Example #2
0
		public ActionResult Add(AddProductToCart addProductToCart)
		{
			_cartHandlers.Handle(addProductToCart);
			return RedirectToAction("Index");
		}