示例#1
0
        public ActionResult StudentList(int?ClassID)
        {
            List <Student> Students = null;

            if (ClassID == null)
            {
                Students = StuBO.GetActiveStudents().OrderByDescending(s => s.StudentID).ToList();
            }
            else
            {
                Students = StuBO.GetStudentInClass(ClassID.Value).OrderByDescending(s => s.StudentID).ToList();
            }

            var Classes = ClaBO.GetActiveClasses();

            ViewBag.ClassID    = SlFactory.MakeSelectList <Class>("ClassID", "ClassName");
            ViewBag.SelectedID = ClassID;
            //new SelectList(Classes.OrderBy(c => c.ClassName), "ClassID", "ClassName", ClassID);
            return(View(Students));
        }