예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            PopulatePartialView();
            SchoolDistrict schoolDistrict = db.SchoolDistricts.Find(id);

            db.SchoolDistricts.Remove(schoolDistrict);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 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));
 }
예제 #3
0
        // 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));
        }