示例#1
0
        public ActionResult AddSchool(opr.Models.School sch)
        {
            Models.opr1Entities db = new opr1Entities();

            db.Schools.Add(sch);
            db.SaveChanges();
            return(View());
        }
示例#2
0
 public ActionResult EditSchool(opr.Models.School schl)
 {
     Models.opr1Entities sub = new opr1Entities();
     sub.Entry(schl).State = System.Data.Entity.EntityState.Modified;
     try
     {
         sub.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
     }
     ModelState.AddModelError("", "Unable to save changes made to the entity.");
     return(View(schl));
 }