public ActionResult DeleteConfirmed(int id) { PopulatePartialView(); SchoolDistrict schoolDistrict = db.SchoolDistricts.Find(id); db.SchoolDistricts.Remove(schoolDistrict); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,SchoolName,Address,City,State,Zip,MainPhone,Website,NumberOfStudents,CountyID")] SchoolDistrict schoolDistrict) { PopulatePartialView(); if (ModelState.IsValid) { db.Entry(schoolDistrict).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(schoolDistrict)); }
// GET: SchoolDistricts/Edit/5 public ActionResult Edit(int?id) { PopulatePartialView(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SchoolDistrict schoolDistrict = db.SchoolDistricts.Find(id); if (schoolDistrict == null) { return(HttpNotFound()); } return(View(schoolDistrict)); }