public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Trainer trainer) { if (id != trainer.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(trainer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TrainerExists(trainer.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(trainer)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Species,Type")] Pokemon pokemon) { if (id != pokemon.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(pokemon); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PokemonExists(pokemon.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(pokemon)); }