示例#1
0
        public async Task <IActionResult> Create([Bind("IdModulo,Capacidad")] Modulo modulo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(modulo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(modulo));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("IdPlanta,IdTipoPlanta,Viva,Crecimiento,IdModulo")] Planta planta)
        {
            if (ModelState.IsValid)
            {
                _context.Add(planta);
                await _context.SaveChangesAsync();

                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));
        }