private SectionDisplay getSectionData(Section section) { string fName = proxy.getUser(section.InstructorID).FirstName; string lName = proxy.getUser(section.InstructorID).LastName; int buildingNum = proxy.getLocation(section.LocationID).BuildingID; int roomNum = proxy.getLocation(section.LocationID).RoomNumber; SectionDisplay sectionData = new SectionDisplay(); sectionData.sectionID = section.ID; sectionData.instructorName = fName + " " + lName; sectionData.courseName = proxy.getCourse(section.CourseID).Name; sectionData.locationName = "Building " + buildingNum + ", Room " + roomNum; return(sectionData); }
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" })); } }