public async Task <IActionResult> Edit(string id, [Bind("CourseId,CourseName")] Courses courses) { if (id != courses.CourseId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(courses); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CoursesExists(courses.CourseId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(courses)); }
public async Task <IActionResult> Edit(string id, [Bind("CourseId,TeacherId,AssignmentDate")] CourseAssignment courseAssignment) { if (id != courseAssignment.CourseId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(courseAssignment); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourseAssignmentExists(courseAssignment.CourseId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CourseId"] = new SelectList(_context.Courses, "CourseId", "CourseId", courseAssignment.CourseId); ViewData["TeacherId"] = new SelectList(_context.Teachers, "TeacherId", "TeacherId", courseAssignment.TeacherId); return(View(courseAssignment)); }
public async Task <IActionResult> Edit(int id, [Bind("TeacherId,Name")] Teachers teachers) { if (id != teachers.TeacherId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(teachers); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeachersExists(teachers.TeacherId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(teachers)); }
public async Task <IActionResult> Edit(int id, [Bind("UserId,Password,JobTitle")] Users users) { if (id != users.UserId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(users); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UsersExists(users.UserId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(users)); }