예제 #1
0
        public void GetCurrentEnrollsForStudentTest_HappyPath()
        {
            List <Enrolled> enrolledList = _enrollService.getCurrentEnrollsForStudent(5);

            Assert.NotNull(enrolledList);
            //Verify that the list contains only the enrollments that it should
            Assert.True(enrolledList.Count == 1);
            Assert.True(enrolledList[0].enrollId == 38);
            Assert.True(enrolledList[0].courseId == 6);
        }
예제 #2
0
        public ActionResult <List <Enrolled> > getCurrentEnrollsForStudent()
        {
            int sid    = Int32.Parse(this.User.FindFirst("sid")?.Value);
            var result = _enrollSerivce.getCurrentEnrollsForStudent(sid);

            return(result);
        }
예제 #3
0
        public ProfileViewModel buildProfileViewModel(Student student)
        {
            if (student == null)
            {
                return(null);
            }

            int remainCreditHours = _studentService.getRemainingCredithoursForStudent(student.studentId);

            string  majorName   = "";
            Faculty tempFaculty = _facultyService.getFaculty(student.majorId);

            if (tempFaculty != null)
            {
                majorName = tempFaculty.facultyName;
            }

            List <CourseContainerViewModel> ccvms   = new List <CourseContainerViewModel>();
            ISet <CourseActions>            actions = new HashSet <CourseActions> {
                CourseActions.ViewDetail, CourseActions.DropCourse
            };
            List <Enrolled> regCourses = _enrollService.getCurrentEnrollsForStudent(student.studentId);

            foreach (Enrolled e in regCourses)
            {
                Course thisCourse             = _courseService.getCourse(e.courseId);
                CourseContainerViewModel ccvm = buildCourseContainerViewModel(thisCourse, actions, e);
                ccvms.Add(ccvm);
            }

            return(new ProfileViewModel
            {
                thisStudent = student,
                majorName = majorName,
                cViewModels = ccvms,
                remainingCreditHours = remainCreditHours
            });
        }