Пример #1
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));
 }
Пример #2
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));
        }
Пример #3
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));
        }
Пример #4
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));
        }
Пример #5
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));
        }
Пример #6
0
        public ActionResult Index(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;

            model.IsDeleted = true;
            model.IsActive  = true;

            opr.Models.oprEntities db = new oprEntities();
            try
            {
                db.Sections.Add(model);
                db.SaveChanges();
            }

            catch (System.Data.Entity.Validation.DbEntityValidationException ex)
            {
                foreach (var entityValidationErrors in ex.EntityValidationErrors)
                {
                    foreach (var validationError in entityValidationErrors.ValidationErrors)
                    {
                        Response.Write("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage);
                    }
                }
            }

            return(View(new Section()));
        }
Пример #7
0
        public string Create(opr.Models.CustomeFeild 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;


            //model.IsDeleted = true;
            //model.IsActive = true;

            opr.Models.oprEntities db = new oprEntities();
            db.CustomeFeilds.Add(model);
            db.SaveChanges();

            return("Saved successfully.");
        }