コード例 #1
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");
        }
コード例 #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"));
        }
コード例 #3
0
ファイル: BasketController.cs プロジェクト: war-man/Ek-Shop
        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));
        }