Example #1
0
        public ActionResult CreateGroup(StudyGroup group)
        {
            try
            {
                StudyGroup sg = new StudyGroup();
                sg.Title = group.Title;
                sg.TeacherId = group.TeacherId;

                db.StudyGroup.Add(sg);
                db.SaveChanges();

                return RedirectToAction("CreateGroup");
            }
            catch
            {
                return View();
            }
        }
Example #2
0
 public ActionResult EditStudyGroup(int id, StudyGroup obj)
 {
     var esg = db.StudyGroup;
     StudyGroup old = esg.SingleOrDefault(sg => sg.Id == id);
     old.Title = obj.Title;
     db.SaveChanges();
     return RedirectToAction("StudyGroup");
 }
Example #3
0
        public ActionResult CreateGroup(StudyGroup studygroup, int List)
        {
            try
            {
                StudyGroup sgTable = new StudyGroup();
                sgTable.Title = studygroup.Title;
                sgTable.TeacherId = List;

                db.StudyGroup.Add(sgTable);
                db.SaveChanges();

                return RedirectToAction("StudyGroup");
            }
            catch
            {
                return View();
            }
        }