public async Task <IActionResult> Edit(Guid id, [Bind("ID,Name,Surname,Dni,BirthDate,Address,Phone,Email")] Teacher teacher) { if (id != teacher.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(teacher); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeacherExists(teacher.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(teacher)); }
public async Task <IActionResult> Edit(Guid id, [Bind("ID,Subject,TeacherID")] Course course) { if (id != course.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(course); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourseExists(course.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["TeacherID"] = new SelectList(_context.Teachers, "ID", "ID", course.TeacherID); return(View(course)); }