Ejemplo n.º 1
0
        public async Task <IActionResult> RemoveOrderItem(Guid orderId, Guid productId)
        {
            var command = new RemoveOrderItemCommand(CustomerId, orderId, productId);
            await _mediatrHandler.SendCommand(command);

            if (IsOperationValid())
            {
                return(RedirectToAction("Index"));
            }

            var shoppingCart = await _orderQueries.GetCustomerShoppingCart(CustomerId);

            return(View("Index", shoppingCart));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> RemoveItem(Guid id)
        {
            var product = await _productAppService.GetById(id);

            if (product == null)
            {
                return(BadRequest());
            }

            var command = new RemoveOrderItemCommand(ClientId, id);
            await _mediatrHandler.SendCommand(command);

            if (ValidOperation())
            {
                return(RedirectToAction("Index"));
            }

            return(View("Index", await _orderQueries.GetCartByClient(ClientId)));
        }
Ejemplo n.º 3
0
 public async Task <JsonResult> RemoveOrderItem(RemoveOrderItemCommand removeOrder)
 {
     return(new JsonResult(await Mediator.Send(removeOrder)));
 }