public async Task <IActionResult> Edit(Guid id, Materia materia) { if (id != materia.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(materia); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MateriaExists(materia.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ProfesorId"] = new SelectList(_context.Profesores, "Id", "Apellido", materia.ProfesorId); return(View(materia)); }
public async Task <IActionResult> Edit(Guid id, [Bind("Id,Nombre,Apellido,Dni,Activo")] Profesor profesor) { if (id != profesor.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(profesor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProfesorExists(profesor.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(profesor)); }