public static List <SUBJECT> GetSubjects(int term) { Dictionary <string, string> D = new Dictionary <string, string>() { { "TERM", term.ToString() }, { "ACTIVE", "1" } }; try { return(DBS.Query <SUBJECT>(D)); } catch { return(new List <SUBJECT>()); } }
public ActionResult _Student(int?Class_id, int?student_id, int?term_id) { checkLogin(); _StudentViewModel SVM = new _StudentViewModel(); //get class num List <CLASS_STUDENT_LIST> ClassStudentMap = new List <CLASS_STUDENT_LIST>(); if (Class_id > 0 && term_id > 0) { Dictionary <string, string> DS = new Dictionary <string, string>() { { "QE_CLASS", Class_id.ToString() }, { "ACTIVE", "1" } }; ClassStudentMap = DBS.Query <CLASS_STUDENT_LIST>(DS); } SVM.ClassStudentMap = ClassStudentMap; //get student list SVM.studentList = Class_id != null && term_id != null?StudentService.GetActiveStudentsByClass((int)Class_id) : new List <STUDENT>(); //get student chosen SVM.selectedStudent = student_id != null && student_id > 0 && SVM.studentList.Exists(s => s.ID == (int)student_id) ? SVM.studentList.Where(s => s.ID == (int)student_id).First() : new STUDENT(); try { SVM.selectedStudentNum = ClassStudentMap.Where(c => c.STUDENT == (int)student_id).FirstOrDefault().CLASS_NUM; } catch { } SVM.selectedClass = (int)Class_id; SVM.selectedTerm = (int)term_id; return(View("_Student", SVM)); }