public async Task <IActionResult> Create([Bind("Id,Name")] Planet planet) { if (ModelState.IsValid) { _context.Add(planet); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(planet)); }
public async Task <IActionResult> Create([Bind("Id,Name,PlanetId")] Hero hero) { if (ModelState.IsValid) { _context.Add(hero); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PlanetId"] = new SelectList(_context.Planet, "Id", "Id", hero.PlanetId); return(View(hero)); }
public async Task <IActionResult> Create([Bind("Id,Img,Name,SuperName,PlanetId,CategoriaId,Power1,Power2,Power3,Universe,Description,Force")] Hero hero) { if (ModelState.IsValid) { _context.Add(hero); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CategoriaId"] = new SelectList(_context.Categoria, "Id", "Id", hero.CategoriaId); ViewData["PlanetId"] = new SelectList(_context.Planet, "Id", "Id", hero.PlanetId); return(View(hero)); }