Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("AniamlId,Name,Habitat,Legs,Food")] Animal animal)
        {
            if (id != animal.AniamlId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(animal);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AnimalExists(animal.AniamlId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(animal));
        }