Пример #1
0
        public ActionResult StudentGroupAndStudents(GroupStudentViewModel GSVM)
        {
            checkLogin();

            bool result = true;

            for (int i = 0; i < GSVM.Student.Count; i++)
            {
                if (result)
                {
                    if (GSVM.Student[i].Contain && GSVM.Student[i].MapID < 1) // constains a map ID means its an existing record
                    {
                        STUDENT_GROUP_STUDENT_LIST newMap = new STUDENT_GROUP_STUDENT_LIST(0, GSVM.Student[i].GroupID, GSVM.Student[i].StudentID, CP.userID, DateTime.Now, 0, Constant.DEF_DATETIME, true);
                        result = false;
                        result = DBS.addRecord(newMap);
                    }
                    else if (!GSVM.Student[i].Contain && GSVM.Student[i].MapID > 0) //not contain but have existing id means need to remove
                    {
                        result = false;
                        result = DBS.InactiveRecord("STUDENT_GROUP_STUDENT_LIST", GSVM.Student[i].MapID, CP.userID);
                    }
                }
            }

            GSVM.TermList = CP.termSelectList;
            ModelState.Clear();
            if (result)
            {
                TempData[Constant.msg_success] = Constant.ChangeSucceed;
            }
            else
            {
                TempData[Constant.msg_error] = Constant.ChangeFailed;
            }
            return(RedirectToAction("_StudentGroupAndStudents", new{ term_id = GSVM.SelectedTerm, group_id = GSVM.SelectedGroup, class_id = GSVM.SelectedClass }));
        }
Пример #2
0
 public static int AddGroupStudentMap(STUDENT_GROUP_STUDENT_LIST newMap)
 {
     int newMap_id = WillORM.InsertRecord(newMap); return(newMap_id > 0 ? newMap_id : 0);
 }