public ActionResult DeleteConfirmed(int?TrimesterID, int?CourseID) { TrimesterCourse trimesterCourse = db.TrimesterCourses .Include(s => s.Course) .Include(s => s.Trimester) .SingleOrDefault(tc => tc.TrimesterID == TrimesterID && tc.CourseID == CourseID); db.TrimesterCourses.Remove(trimesterCourse); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "TrimesterID,CourseID,Year")] TrimesterCourse trimesterCourse) { if (ModelState.IsValid) { db.Entry(trimesterCourse).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CourseID = new SelectList(db.Courses, "CourseID", "CourseName", trimesterCourse.CourseID); ViewBag.TrimesterID = new SelectList(db.Trimesters, "TrimesterID", "TrimesterID", trimesterCourse.TrimesterID); return(View(trimesterCourse)); }
// GET: TrimesterCourses/Details/5 public ActionResult Details(int?TrimesterID, int?CourseID) { if (TrimesterID == null || CourseID == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } // Setup up the data for course codes. Setup.InitializeCourseCode(db); TrimesterCourse trimesterCourse = db.TrimesterCourses .Include(s => s.Course) .Include(s => s.Trimester) .SingleOrDefault(tc => tc.TrimesterID == TrimesterID && tc.CourseID == CourseID); if (trimesterCourse == null) { return(HttpNotFound()); } return(View(trimesterCourse)); }
// GET: TrimesterCourses/Edit/5 public ActionResult Edit(int?TrimesterID, int?CourseID) { if (TrimesterID == null || CourseID == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } // Setup up the data for course codes. Setup.InitializeCourseCode(db); TrimesterCourse trimesterCourse = db.TrimesterCourses .Include(s => s.Course) .Include(s => s.Trimester) .SingleOrDefault(tc => tc.TrimesterID == TrimesterID && tc.CourseID == CourseID); if (trimesterCourse == null) { return(HttpNotFound()); } ViewBag.CourseID = new SelectList(db.Courses, "CourseID", "CourseName", trimesterCourse.CourseID); ViewBag.TrimesterID = new SelectList(db.Trimesters, "TrimesterID", "TrimesterID", trimesterCourse.TrimesterID); return(View(trimesterCourse)); }