public void getSectionStudentsAPITest()
        {
            Section section = proxy.getSection(1);

            Student[] students = proxy.getSectionStudents(section);
            Assert.IsNotNull(students);
        }
Esempio n. 2
0
        public ActionResult Create(int instructorID, int maxStudents, int courseID, string termCode, int classroomID)
        {
            if (!loggedIn())
            {
                return(RedirectToAction("Index", "Login", new { redirectAction = "Index", redirectController = "Section" }));
            }
            if (!checkPermission("professor") && !checkPermission("admin"))
            {
                return(RedirectToAction("AccessDenied", "Home"));
            }

            Course     course     = proxy.getCourse(courseID);
            Instructor instructor = proxy.getInstructor(instructorID);
            Term       term       = proxy.getTerm(termCode);
            Location   location   = proxy.getLocation(classroomID);

            bool success = true;

            if (course != null && instructor != null && term != null && location != null)
            {
                Section section = new Section(0, maxStudents, term.ID, instructorID, courseID, classroomID, true);
                int     id      = proxy.createSection(section);
                if (id == -1 || proxy.getSection(id) == null)
                {
                    success = false;
                }
            }
            else
            {
                success = false;
            }

            if (success)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                return(RedirectToAction("Create", new { courseID = courseID, message = "There was an error creating the section" }));
            }
        }