Exemplo n.º 1
0
        public ActionResult <ShoppingCartDto> Create([FromBody] CreateCartDto createCart)
        {
            try
            {
                var result = _shoppingCartManager.Create(createCart);

                return(CreatedAtRoute("GetCart", new { id = result.Id }, result));
            }
            catch (InvalidInputException ex)
            {
                _logger.LogError($"Failed to create new shopping cart:\n{ex}");

                return(BadRequest());
            }
        }