public ActionResult DeleteConfirmed(string id)
        {
            SchoolAndStudent schoolAndStudent = db.SchoolAndStudents.Find(id);

            db.SchoolAndStudents.Remove(schoolAndStudent);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "StudntID,SchoolID,StudiesInID")] SchoolAndStudent schoolAndStudent)
 {
     if (ModelState.IsValid)
     {
         db.Entry(schoolAndStudent).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.SchoolID = new SelectList(db.Schools, "SchoolID", "Name", schoolAndStudent.SchoolID);
     ViewBag.StudntID = new SelectList(db.Students, "studentID", "Name", schoolAndStudent.StudntID);
     return(View(schoolAndStudent));
 }
        // GET: SchoolAndStudents/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SchoolAndStudent schoolAndStudent = db.SchoolAndStudents.Find(id);

            if (schoolAndStudent == null)
            {
                return(HttpNotFound());
            }
            return(View(schoolAndStudent));
        }
        // GET: SchoolAndStudents/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SchoolAndStudent schoolAndStudent = db.SchoolAndStudents.Find(id);

            if (schoolAndStudent == null)
            {
                return(HttpNotFound());
            }
            ViewBag.SchoolID = new SelectList(db.Schools, "SchoolID", "Name", schoolAndStudent.SchoolID);
            ViewBag.StudntID = new SelectList(db.Students, "studentID", "Name", schoolAndStudent.StudntID);
            return(View(schoolAndStudent));
        }