public ActionResult DeleteConfirmed(int id)
        {
            LinkCourseDept linkCourseDept = db.LinkCourseDepts.Find(id);

            db.LinkCourseDepts.Remove(linkCourseDept);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID,Course_id,Department_id")] LinkCourseDept linkCourseDept)
 {
     if (ModelState.IsValid)
     {
         db.Entry(linkCourseDept).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Course_id     = new SelectList(db.Courses, "ID", "Name", linkCourseDept.Course_id);
     ViewBag.Department_id = new SelectList(db.Departments, "ID", "Name", linkCourseDept.Department_id);
     return(View(linkCourseDept));
 }
        public ActionResult Create([Bind(Include = "ID,Course_id,Department_id")] LinkCourseDept linkCourseDept)
        {
            if (ModelState.IsValid)
            {
                db.LinkCourseDepts.Add(linkCourseDept);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Course_id     = new SelectList(db.Courses, "ID", "Name", linkCourseDept.Course_id);
            ViewBag.Department_id = new SelectList(db.Departments, "ID", "Name", linkCourseDept.Department_id);
            return(View(linkCourseDept));
        }
        // GET: LinkCourseDepts/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LinkCourseDept linkCourseDept = db.LinkCourseDepts.Find(id);

            if (linkCourseDept == null)
            {
                return(HttpNotFound());
            }
            return(View(linkCourseDept));
        }
        // GET: LinkCourseDepts/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LinkCourseDept linkCourseDept = db.LinkCourseDepts.Find(id);

            if (linkCourseDept == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Course_id     = new SelectList(db.Courses, "ID", "Name", linkCourseDept.Course_id);
            ViewBag.Department_id = new SelectList(db.Departments, "ID", "Name", linkCourseDept.Department_id);
            return(View(linkCourseDept));
        }