public void getStudentSectionsAPITest() { Student student = proxy.getStudent(1); Section[] sections = this.proxy.getStudentSections(student); Assert.IsNotNull(sections); }
public ActionResult SectionsList() { ViewData["title"] = "Enrollment Dashboard"; IProxy proxy = new APIProxy(); //If the user and role aren't null if (Session["user"] != null && Session["role"] != null) { User currentUser = (User)Session["user"]; //If the user is a student if (String.Equals("student", (string)Session["Role"], StringComparison.OrdinalIgnoreCase)) { Student student = proxy.getStudent(currentUser.ID); currentSections = proxy.getStudentSections(student); } //If the user is an instructor else if (String.Equals("professor", (string)Session["Role"], StringComparison.OrdinalIgnoreCase)) { Instructor instructor = proxy.getInstructor(currentUser.ID); currentSections = proxy.getInstructorSections(instructor); } //If the user is an admin else if (String.Equals("admin", (string)Session["Role"], StringComparison.OrdinalIgnoreCase)) { } } return(View(currentSections)); }
public ActionResult Index() { if (!loggedIn()) { return(RedirectToAction("Index", "Login")); } ViewData["title"] = "Enrollment Dashboard"; //If the user and role aren't null if (Session["role"] != null) { ViewData["Role"] = Session["role"]; currentUser = (User)Session["user"]; //If the user is a student if (checkPermission("student")) { ViewData["SectionsTitle"] = "Enrolled Sections"; Student student = proxy.getStudent(currentUser.ID); currentSections = proxy.getStudentSections(student); Section[] currentWaitlists = proxy.getStudentWaitlists(student); List <SectionDisplay> waitlists = new List <SectionDisplay>(); for (int i = 0; i < currentWaitlists.Length; i++) { waitlists.Add(getSectionData(currentWaitlists[i])); } ViewData["StudentWaitlists"] = waitlists.ToArray(); } //If the user is an instructor else if (checkPermission("professor")) { ViewData["SectionsTitle"] = "Instructor Sections"; currentSections = proxy.getInstructorSectionsByID(currentUser.ID); } //If the user is an admin else if (checkPermission("admin")) { return(RedirectToAction("Index", "Admin")); } } for (int i = 0; i < currentSections.Length; i++) { sectionsData.Add(getSectionData(currentSections[i])); } return(View(sectionsData.ToArray())); }