public async Task <IActionResult> Edit(int id, [Bind("FormularioAmenazaID,FormularioID,CatalogoAmenazaID")] FormularioAmenaza formularioAmenaza) { if (id != formularioAmenaza.FormularioAmenazaID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(formularioAmenaza); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FormularioAmenazaExists(formularioAmenaza.FormularioAmenazaID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CatalogoAmenazaID"] = new SelectList(_context.CatalogoAmenaza, "CatalogoAmenazaID", "Descripcion", formularioAmenaza.CatalogoAmenazaID); ViewData["FormularioID"] = new SelectList(_context.Formulario, "FormularioID", "CuidoIndicadores", formularioAmenaza.FormularioID); return(View(formularioAmenaza)); }
public async Task <IActionResult> Create([Bind("FormularioAmenazaID,FormularioID,CatalogoAmenazaID")] FormularioAmenaza formularioAmenaza) { if (ModelState.IsValid) { _context.Add(formularioAmenaza); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CatalogoAmenazaID"] = new SelectList(_context.CatalogoAmenaza, "CatalogoAmenazaID", "Descripcion", formularioAmenaza.CatalogoAmenazaID); ViewData["FormularioID"] = new SelectList(_context.Formulario, "FormularioID", "CuidoIndicadores", formularioAmenaza.FormularioID); return(View(formularioAmenaza)); }