public ActionResult RegisterSubject(string Id_Class, string Id_Subject, string Id_Teacher, int Year_Term) { if (Session["student_subject"] == null) { var gv = TeacherAction.GetAll(); var mh = SubjectAction.GetAll(); var lop = ClassAction.GetAll(); var nam = YearTermAction.GetAll(); var teacher_info = gv.Find(a => a.id == Id_Teacher); var subject_infor = mh.Find(a => a.id == Id_Subject); var class_info = lop.Find(a => a.id == Id_Class); var year_info = nam.Find(a => a.year_term == Year_Term); List <Tuple <Subject, YearTerm, Class, Teacher> > lst = new List <Tuple <Subject, YearTerm, Class, Teacher> >(); Tuple <Subject, YearTerm, Class, Teacher> tup = new Tuple <Subject, YearTerm, Class, Teacher>(subject_infor, year_info, class_info, teacher_info); lst.Add(tup); Session["student_subject"] = lst; } else { List <Tuple <Subject, YearTerm, Class, Teacher> > lst = (List <Tuple <Subject, YearTerm, Class, Teacher> >)Session["student_subject"]; var gv = TeacherAction.GetAll(); var mh = SubjectAction.GetAll(); var lop = ClassAction.GetAll(); var nam = YearTermAction.GetAll(); var teacher_info = gv.Find(a => a.id == Id_Teacher); var subject_infor = mh.Find(a => a.id == Id_Subject); var class_info = lop.Find(a => a.id == Id_Class); var year_info = nam.Find(a => a.year_term == Year_Term); Tuple <Subject, YearTerm, Class, Teacher> tup = new Tuple <Subject, YearTerm, Class, Teacher>(subject_infor, year_info, class_info, teacher_info); lst.Add(tup); Session["student_subject"] = lst; } return(Redirect("~/Student/RegisterSubject")); }
public ActionResult CreateSubject() { if ((string)Session["role"] == "Admin") { ViewBag.ChuyenNganh = SpecializedAction.GetAll(); ViewBag.Nganh = MajorAction.GetAll(); ViewBag.Lop = ClassAction.GetAll(); ViewBag.MH = SubjectAction.ShowAll(); ViewBag.GV = TeacherAction.GetAll(); ViewBag.YearTerm = YearTermAction.GetAll(); return(View()); } else { return(Redirect("~/Home/Index")); } }