Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,published")] ShoppingList shoppingList)
        {
            if (id != shoppingList.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _shoppingListService.Edit(shoppingList);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShoppingListExists(shoppingList.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(shoppingList));
        }