public async Task <IActionResult> Edit(int id, [Bind("IdModulo,Capacidad")] Modulo modulo) { if (id != modulo.IdModulo) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(modulo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ModuloExists(modulo.IdModulo)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(modulo)); }
public async Task <IActionResult> Edit(int id, [Bind("IdPlanta,IdTipoPlanta,Viva,Crecimiento,IdModulo")] Planta planta) { if (id != planta.IdPlanta) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(planta); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlantaExists(planta.IdPlanta)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IdModulo"] = new SelectList(_context.Modulos, "IdModulo", "IdModulo", planta.IdModulo); ViewData["IdTipoPlanta"] = new SelectList(_context.Set <TipoPlanta>(), "IdTipoPlanta", "Nombre", planta.IdTipoPlanta); return(View(planta)); }