Example #1
0
        public async Task <IActionResult> Post(Guid userId, [FromBody] AddProductToCartDTO dto)
        {
            var command = new AddProductToCartCommand(userId, dto.ProductId);
            var result  = await CartSystem.AddProductToCart(command);

            if (result.IsSuccessful)
            {
                return(Ok());
            }
            ;
            return(BadRequest(result.Message));
        }
 public async Task AddProductToCart(Guid id, Guid productId, [FromBody] AddProductToCartDTO dto)
 {
     await _app.SendAsync(new AddProductToCart(id, productId, dto.Price));
 }