Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,DisplayOrder,Name")] Category category)
        {
            if (id != category.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    category = await _orderServices.EditCategoryAsync(category);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!await _orderServices.CategoryExists(category.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }