public void SetUpServices()
        {
            shoppingCartProductResponse = new ShoppingCartProductResponse();
            shoppingCartProductRequest = new ShoppingCartProductRequest();

            shoppingCartProductService = new Mock<IShoppingCartProductService>();
            shoppingCartProductService.Setup(s => s.AddShoppingCartProduct(shoppingCartProductRequest)).Returns(shoppingCartProductResponse);
            shoppingCartProductService.Setup(s => s.DeleteShoppingCartProduct(shoppingCartProductRequest)).Returns(shoppingCartProductResponse);
            shoppingCartProductService.Setup(s => s.ClearShoppingCartProducts()).Returns(shoppingCartProductResponse);
        }
        public IHttpActionResult DeleteShoppingCartProduct(ShoppingCartProductRequest request)
        {
            ShoppingCartProductResponse response = shoppingCartProductService.DeleteShoppingCartProduct(request);

            if (response.Success)
            {
                return Ok("The product has been successfully removed.");
            }
            else
            {
                return BadRequest();
            }
        }
        public ShoppingCartProductResponse DeleteShoppingCartProduct(ShoppingCartProductRequest request)
        {
            ShoppingCartProductResponse response = new ShoppingCartProductResponse();

            try
            {
                ShoppingCartProduct dbShoppingCartProduct = shoppingCartProductRepository.FindShoppingCartProduct(this.shoppingCartId, request.ProductId);

                if (dbShoppingCartProduct != null)
                {
                    shoppingCartProductRepository.Delete(dbShoppingCartProduct);
                    shoppingCartProductRepository.Commit();
                }
            }
            catch (Exception ex)
            {
                response.Exception = ex;
            }

            return response;
        }
        public ShoppingCartProductResponse AddShoppingCartProduct(ShoppingCartProductRequest request)
        {
            ShoppingCartProductResponse response = new ShoppingCartProductResponse();

            try
            {
                ShoppingCartProduct dbShoppingCartProduct = shoppingCartProductRepository.FindShoppingCartProduct(this.shoppingCartId, request.ProductId);

                //If entry exists, update existing
                if (dbShoppingCartProduct != null)
                {
                    dbShoppingCartProduct.Quantity += request.Quantity;                    
                }
                //Else create a new one. Skip if quantity is set to zero.
                else if(request.Quantity != 0)
                {
                    ShoppingCartProduct newShoppingCartProduct = new ShoppingCartProduct()
                    {
                        ProductId = request.ProductId
                        ,ShoppingCartId = this.shoppingCartId
                        ,Quantity = request.Quantity
                    };

                    shoppingCartProductRepository.Add(newShoppingCartProduct);
                }

                shoppingCartProductRepository.Commit();
            }
            catch (Exception ex)
            {

                response.Exception = ex;
            }

            return response;
        }