Exemplo n.º 1
0
        public ActionResult <Item> UpdateItem(string cartId, string itemId, [FromBody] Item item)
        {
            try
            {
                item = store.UpdateItem(cartId, itemId, item.Product, item.Quantity);

                return(Ok(item));
            }
            catch (ValidationException) { return(StatusCode(400)); }
            catch (CartNotFoundException) { return(StatusCode(404)); }
            catch (ItemNotFoundException) { return(StatusCode(404)); }
            catch (Exception) { return(StatusCode(500)); }
        }