コード例 #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;
            }
        }