public ActionResult Create(CmStudentSubject cmstudentsubject) { if (ModelState.IsValid) { context.CmStudentSubjects.Add(cmstudentsubject); context.SaveChanges(); return RedirectToAction("Index"); } ViewBag.PossiblecmStudents = context.CmStudents; ViewBag.PossibleclSubjects = context.ClSubjects; ViewBag.PossiblecmTeachers = context.CmTeachers; return View(cmstudentsubject); }
public ActionResult Edit(CmStudentSubject cmstudentsubject) { if (ModelState.IsValid) { context.Entry(cmstudentsubject).State = EntityState.Modified; context.SaveChanges(); return RedirectToAction("Index"); } ViewBag.PossiblecmStudents = context.CmStudents; ViewBag.PossibleclSubjects = context.ClSubjects; ViewBag.PossiblecmTeachers = context.CmTeachers; return View(cmstudentsubject); }