public async Task <IActionResult> Create([Bind("Id,Nombre")] Region region) { if (ModelState.IsValid) { _context.Add(region); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(region)); }
public async Task <IActionResult> Create([Bind("Id,Tipo1")] Tipo tipo) { if (ModelState.IsValid) { _context.Add(tipo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tipo)); }
public async Task <IActionResult> Create([Bind("Id,Nombre,Ataque1,Ataque2,Ataque3,Ataque4,Region,Tipo")] Pokemon pokemon) { if (ModelState.IsValid) { _context.Add(pokemon); await _context.SaveChangesAsync(); 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)); }