public ActionResult DeleteConfirmed(int id) { tblSchool tblschool = db.tblSchools.Find(id); db.tblSchools.Remove(tblschool); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "SchoolId,DistrictId,SchoolDesc,AddressId,CreateDatetime,ChangeDatetime")] tblSchool tblschool) { if (ModelState.IsValid) { db.Entry(tblschool).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AddressId = new SelectList(db.tblAddresses, "AddressId", "Address1", tblschool.AddressId); ViewBag.DistrictId = new SelectList(db.tblDistricts, "DistrictId", "DistrictDesc", tblschool.DistrictId); return(View(tblschool)); }
// GET: /Schools/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tblSchool tblschool = db.tblSchools.Find(id); if (tblschool == null) { return(HttpNotFound()); } return(View(tblschool)); }
// GET: /Schools/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tblSchool tblschool = db.tblSchools.Find(id); if (tblschool == null) { return(HttpNotFound()); } ViewBag.AddressId = new SelectList(db.tblAddresses, "AddressId", "Address1", tblschool.AddressId); ViewBag.DistrictId = new SelectList(db.tblDistricts, "DistrictId", "DistrictDesc", tblschool.DistrictId); return(View(tblschool)); }