public async Task <IActionResult> Edit(int id, [Bind("IdSubcaracteristica,Nombre,IdCaracteristica")] Subcaracteristica subcaracteristica) { if (id != subcaracteristica.IdSubcaracteristica) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(subcaracteristica); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SubcaracteristicaExists(subcaracteristica.IdSubcaracteristica)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IdCaracteristica"] = new SelectList(_context.Caracteristica, "IdCaracteristica", "Nombre", subcaracteristica.IdCaracteristica); return(View(subcaracteristica)); }
public async Task <IActionResult> Create([Bind("IdSubcaracteristica,Nombre,IdCaracteristica")] Subcaracteristica subcaracteristica) { if (ModelState.IsValid) { _context.Add(subcaracteristica); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IdCaracteristica"] = new SelectList(_context.Caracteristica, "IdCaracteristica", "Nombre", subcaracteristica.IdCaracteristica); return(View(subcaracteristica)); }