public ActionResult RegisterSubject() { //ViewBag.MH = SubjectAction.ShowAll(); if ((string)Session["role"] == "Student") { var tmp = SubjectAction.ShowAll(); List <Tuple <RegisterSubject, Student> > subject = StudentAction.GetAllSubject(); List <Tuple <Subject, YearTerm, Class, Teacher> > lst = (List <Tuple <Subject, YearTerm, Class, Teacher> >)Session["student_subject"]; if (lst != null) { for (int i = 0; i < lst.Count; i++) { tmp.RemoveAll(a => a.Item1.id == lst[i].Item1.id); } } if (subject != null) { for (int i = 0; i < subject.Count; i++) { tmp.RemoveAll(a => a.Item1.id == subject[i].Item1.id_subject); } } ViewBag.DK = lst; ViewBag.Mh = tmp; return(View()); } else { return(Redirect("~/Home/Index")); } }
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")); } }