public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,Ataque1,Ataque2,Ataque3,Ataque4,Region,Tipo")] 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))); } ViewData["Region"] = new SelectList(_context.Region, "Id", "Nombre", pokemon.Region); ViewData["Tipo"] = new SelectList(_context.Tipo, "Id", "Tipo1", pokemon.Tipo); return(View(pokemon)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre")] Region region) { if (id != region.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(region); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RegionExists(region.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(region)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Tipo1")] Tipo tipo) { if (id != tipo.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tipo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TipoExists(tipo.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tipo)); }