Exemplo n.º 1
0
        private async Task AddShoppingListItem()
        {
            string newValue = viewModel.NewShoppingListItemValue;

            if (!string.IsNullOrWhiteSpace(newValue))
            {
                var newItem = new ShoppingListItem
                {
                    Title = newValue
                };

                await service.Add(newItem);

                viewModel.ShoppingListItems.Add(newItem);
                viewModel.NewShoppingListItemValue = null;
            }
        }
        public IHttpActionResult Add([FromBody] ShoppingItemDto item)
        {
            _shoppingListService.Add(item);

            return(Ok());
        }