public ActionResult Add(int productid)
        {
            Guid basket_id = get_basket_id();

            // TODO: Query system to see if a product with the id exists

            var add_product_to_basket = new AddProductToBasketCommand(productid, basket_id);
            _application.action_request_to(add_product_to_basket);

            return Redirect("Index");
        }
Example #2
0
        public ActionResult Add(int productid)
        {
            Guid basket_id = get_basket_id();

            // TODO: Query system to see if a product with the id exists

            var add_product_to_basket = new AddProductToBasketCommand(productid, basket_id);

            _application.action_request_to(add_product_to_basket);

            return(Redirect("Index"));
        }
Example #3
0
        public async Task <IActionResult> AddProductToBasket([FromBody] AddProductToBasketCommand command)
        {
            var productDtoResult = await QueryProcessor.GetQueryHandler <AddProductToBasketCommand, ProductDto>(command);

            if (productDtoResult.Failure)
            {
                return(BadRequest(productDtoResult.ErrorMessages));
            }

            var productDto = productDtoResult.Object;

            return(Ok(productDto));
        }