Ejemplo n.º 1
0
        public ActionResult EditView(opr.Models.Section model)
        {
            Models.oprEntities dbs = new oprEntities();
            var        mod         = dbs.DefTables.Select(s => new { s.TableId, s.TableName }).ToList();
            SelectList selectList  = new SelectList(mod, "TableName", "TableName");

            ViewBag.dataForDropDown = selectList;

            var        mods        = dbs.DefControls.Select(c => new { c.ControId, c.ControlName }).ToList();
            SelectList selectLists = new SelectList(mods, "ControlName", "ControlName");

            ViewBag.dataForDropDowns = selectLists;

            Models.oprEntities db = new oprEntities();
            db.Entry(model).State = System.Data.Entity.EntityState.Modified;
            try
            {
                db.SaveChanges();
                return(RedirectToAction("SectionDetail"));
            }
            catch
            {
            }
            ModelState.AddModelError("", "Unable to save changes");
            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult DeleteClass(int id)
        {
            Models.oprEntities db      = new oprEntities();
            ClassesTable       classdt = db.ClassesTables.Find(id);

            classdt.IsDeleted       = true;
            db.Entry(classdt).State = System.Data.Entity.EntityState.Modified;

            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
        public ActionResult IsDelete(int Id)
        {
            oprEntities db      = new oprEntities();
            Group       classdt = db.Groups.Find(Id);

            classdt.IsDeleted       = true;
            db.Entry(classdt).State = System.Data.Entity.EntityState.Modified;

            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 4
0
 public ActionResult DeleteData(opr.Models.Section model)
 {
     Models.oprEntities db = new oprEntities();
     db.Entry(model).State = System.Data.Entity.EntityState.Modified;
     try
     {
         db.SaveChanges();
         return(RedirectToAction("SectionDetail"));
     }
     catch
     {
     }
     ModelState.AddModelError("", "Unable to save changes");
     return(View(model));
 }
Ejemplo n.º 5
0
 public ActionResult EditSchool(opr.Models.School schl)
 {
     Models.oprEntities sub = new oprEntities();
     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));
 }
Ejemplo n.º 6
0
        public ActionResult EditGroup(opr.Models.Group grp)
        {
            oprEntities groupData = new oprEntities();

            groupData.Entry(grp).State = System.Data.Entity.EntityState.Modified;
            try
            {
                groupData.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
            }
            ModelState.AddModelError("", "Unable to save changes made to the entity.");
            return(View(grp));
        }
Ejemplo n.º 7
0
        public ActionResult EditStudent(Student_Table stutable)
        {
            oprEntities editdb = new oprEntities();

            editdb.Entry(stutable).State = EntityState.Modified;
            try
            {
                editdb.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
            }

            ModelState.AddModelError("", "Data Cannot edit ");
            return(View(editdb));
        }
Ejemplo n.º 8
0
        public ActionResult EditClass(opr.Models.ClassesTable model)
        {
            oprEntities cls = new oprEntities();

            model.IsDeleted        = true;
            model.IsActive         = true;
            cls.Entry(model).State = System.Data.Entity.EntityState.Modified;
            try
            {
                cls.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
            }
            ModelState.AddModelError("", "Unable to save changes");
            return(View(model));
        }
Ejemplo n.º 9
0
        public ActionResult EditCampus(Campus_Table camtbl)
        {
            oprEntities camdb = new oprEntities();


            camdb.Entry(camtbl).State = EntityState.Modified;

            try
            {
                camdb.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
            }
            ModelState.AddModelError("", "Unable to Save Changes made to the Entity :(");

            return(View(camtbl));
        }