Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            tblSchool tblschool = db.tblSchools.Find(id);

            db.tblSchools.Remove(tblschool);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
 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));
 }
Example #3
0
        // 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));
        }
Example #4
0
        // 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));
        }