コード例 #1
0
        public ActionResult EditStudent(int Id)
        {
            oprEntities   editdb      = new oprEntities();
            Student_Table editstudent = editdb.Student_Table.Find(Id);

            return(View(editstudent));
        }
コード例 #2
0
        public ActionResult EditView(int id)
        {
            Models.oprEntities db        = new oprEntities();
            Section            Sectiondt = db.Sections.Find(id);

            return(View(Sectiondt));
        }
コード例 #3
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));
        }
コード例 #4
0
        public ActionResult AddStudent(Student_Table studtbl)
        {
            oprEntities studdb = new oprEntities();

            studdb.Student_Table.Add(studtbl);
            studdb.SaveChanges();
            return(View());
        }
コード例 #5
0
        public ActionResult AddSchool(opr.Models.School sch)
        {
            Models.oprEntities db = new oprEntities();

            db.Schools.Add(sch);
            db.SaveChanges();
            return(View());
        }
コード例 #6
0
ファイル: CampusController.cs プロジェクト: SicoGB/opreRepo
        // GET: Campus
        public ActionResult Index()
        {
            oprEntities         camdb        = new oprEntities();
            List <Campus_Table> listOfCampus = new List <Campus_Table>();
            var list = camdb.Campus_Table.ToList();

            return(View(list));
        }
コード例 #7
0
        // GET: Group
        public ActionResult Index()
        {
            oprEntities  dbgrp       = new oprEntities();
            List <Group> listOfGroup = new List <Group>();
            var          saveGroup   = dbgrp.Groups.ToList();

            return(View(saveGroup));
        }
コード例 #8
0
        // GET: School
        public ActionResult Index()
        {
            Models.oprEntities   db    = new oprEntities();
            List <Models.School> model = new List <School>();

            model = db.Schools.ToList();
            return(View(model));
        }
コード例 #9
0
        public ActionResult EditClass(int id)
        {
            ViewBag.ModifiedBy = User.Identity.GetUserName();
            Models.oprEntities db    = new oprEntities();
            ClassesTable       edata = db.ClassesTables.Find(id);


            return(View(edata));
        }
コード例 #10
0
        // GET: Classes
        public ActionResult Index()
        {
            Models.oprEntities         dt    = new oprEntities();
            List <Models.ClassesTable> model = new List <ClassesTable>();

            model = dt.ClassesTables.Where(r => r.IsActive == true && r.IsDeleted == true).ToList();

            return(View(model));
        }
コード例 #11
0
        public ActionResult SectionDetail()
        {
            Models.oprEntities     db    = new oprEntities();
            IList <Models.Section> model = new List <Section>();

            model = db.Sections.ToList();

            return(View(model));
        }
コード例 #12
0
ファイル: StudentController.cs プロジェクト: SicoGB/awaisOpr
        public ActionResult AddStudent()
        {
            Models.oprEntities         dt    = new oprEntities();
            List <Models.StudentTable> model = new List <StudentTable>();

            model          = dt.StudentTables.ToList();
            ViewBag.UserId = User.Identity.GetUserId();
            return(View(model));
        }
コード例 #13
0
        public ActionResult DeleteStudent(int Id)
        {
            oprEntities   deletedb = new oprEntities();
            Student_Table delete   = deletedb.Student_Table.Find(Id);

            deletedb.Student_Table.Remove(delete);
            deletedb.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #14
0
        // GET: Student
        public ActionResult Index()
        {
            oprEntities          studDb        = new oprEntities();
            List <Student_Table> listOfStudent = new List <Student_Table>();

            var list = studDb.Student_Table.ToList();

            return(View(list));
        }
コード例 #15
0
        public ActionResult Delete(int id)
        {
            Models.oprEntities sub           = new oprEntities();
            School             student_table = sub.Schools.Find(id);

            sub.Schools.Remove(student_table);
            sub.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #16
0
        public ActionResult DeleteGroup(int Id)
        {
            oprEntities obj = new oprEntities();
            Group       grp = obj.Groups.Find(Id);

            obj.Groups.Remove(grp);
            obj.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #17
0
ファイル: CampusController.cs プロジェクト: SicoGB/opreRepo
        public ActionResult AddCampus(Campus_Table tabl)
        {
            oprEntities camdb = new oprEntities();

            camdb.Campus_Table.Add(tabl);
            camdb.SaveChanges();

            return(View());
        }
コード例 #18
0
        //public ActionResult DeleteData(int id)
        //{
        //    Models.oprEntities db = new oprEntities();
        //    Section Sectiondt = db.Sections.Find(id);

        //    db.Sections.Remove(Sectiondt);
        //    db.SaveChanges();
        //    return RedirectToAction("SectionDetail");
        //}

        //public ActionResult DeleteData(int id)
        //{
        //    Models.oprEntities db = new oprEntities();
        //    Section Sectiondt = db.Sections.Find(id);
        //    return View(Sectiondt);

        //    //var user = new User() { Id = userId, Password = password };
        //    //using (var db = new MyEfContextName())
        //    //{
        //    //    db.Users.Attach(user);
        //    //    db.Entry(user).Property(x => x.Password).IsModified = true;
        //    //    db.SaveChanges();
        //    //}
        //    //return RedirectToAction("Index");
        //}

        public ActionResult DeleteData(int id)
        {
            Section model = new Section();

            model.IsDeleted = true;
            Models.oprEntities db        = new oprEntities();
            Section            Sectiondt = db.Sections.Find(id);

            return(View(Sectiondt));
        }
コード例 #19
0
        public ActionResult EditGroup(int Id)
        {
            ViewBag.date = DateTime.Now;
            ViewBag.ids  = User.Identity.GetUserId();
            ViewBag.name = User.Identity.Name;
            oprEntities grdata = new oprEntities();
            Group       edata  = grdata.Groups.Find(Id);

            return(View(edata));
        }
コード例 #20
0
ファイル: StudentController.cs プロジェクト: SicoGB/awaisOpr
        public ActionResult AddStudent(opr.Models.StudentTable model)
        {
            oprEntities db = new oprEntities();


            db.StudentTables.Add(model);

            db.SaveChanges();
            return(View());
        }
コード例 #21
0
ファイル: CampusController.cs プロジェクト: SicoGB/opreRepo
        public ActionResult DeleteCampus(int Id)
        {
            oprEntities  camdb     = new oprEntities();
            Campus_Table deletecam = camdb.Campus_Table.Find(Id);

            camdb.Campus_Table.Remove(deletecam);
            camdb.SaveChanges();

            return(RedirectToAction("Index"));
        }
コード例 #22
0
        public ActionResult AddGroup(opr.Models.Group mod)
        {
            oprEntities dbgrp = new oprEntities();

            dbgrp.Groups.Add(mod);
            dbgrp.SaveChanges();


            return(View());
        }
コード例 #23
0
        public ActionResult AddClass(opr.Models.ClassesTable model)
        {
            oprEntities db = new oprEntities();


            db.ClassesTables.Add(model);

            db.SaveChanges();
            return(View());
        }
コード例 #24
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"));
        }
コード例 #25
0
ファイル: CampusController.cs プロジェクト: SicoGB/opreRepo
        public ActionResult EditCampus(int Id)
        {
            ViewBag.userName = User.Identity.Name;
            ViewBag.idcam    = User.Identity.GetUserId();
            ViewBag.date     = DateTime.Now;

            oprEntities  camdb   = new oprEntities();
            Campus_Table camdata = camdb.Campus_Table.Find(Id);

            return(View(camdata));
        }
コード例 #26
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"));
        }
コード例 #27
0
        public ActionResult Index(opr.Models.Section model)

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

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

            return(View(new Section()));
        }
コード例 #28
0
        public ActionResult EditSchool(int id)
        {
            Models.oprEntities obj = new oprEntities();
            ViewBag.modifiedBy = User.Identity.Name;
            var eid = obj.Schools.Where(w => w.Id == id).FirstOrDefault();

            if (obj == null)
            {
                return(RedirectToAction("Index"));
            }

            return(View(eid));
        }
コード例 #29
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));
 }
コード例 #30
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));
 }