// GET: StudentCourseAssociation/Create public ActionResult Create() { StudentCourseAssociationViewModel studentCourseAssociationViewModel = new StudentCourseAssociationViewModel { StudentCourseAssociation = new StudentCourseAssociation(), Students = studentService.GetAll(), Courses = courseService.GetAll() }; return(View(studentCourseAssociationViewModel)); }
// GET: StudentCourseAssociation/Edit/5 public ActionResult Edit(int id) { StudentCourseAssociation studentCourseAssociation = studentCourseAssociationService.Get(id); StudentCourseAssociationViewModel studentCourseAssociationViewModel = new StudentCourseAssociationViewModel { StudentCourseAssociation = studentCourseAssociation, Students = studentService.GetAll(), Courses = courseService.GetAll() }; return(View(studentCourseAssociationViewModel)); }
public ActionResult Edit(int id, StudentCourseAssociationViewModel studentCourseAssociationViewModel) { StudentCourseAssociation studentCourseAssociation = studentCourseAssociationViewModel.StudentCourseAssociation; try { studentCourseAssociationService.Edit(studentCourseAssociation); return(RedirectToAction("Index")); } catch (Exception ex) { return(View(studentCourseAssociationViewModel)); } }