Beispiel #1
0
        // GET: Student/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null || !id.HasValue)
            {
                return(RedirectToAction("Index", "Student"));
            }

            studentSubjectService = new StudentSubjectService();
            gradeService          = new GradeService();
            studentService        = new StudentService();

            Student student = studentService.GetStudentByID((int)id);

            if (student == null)
            {
                return(RedirectToAction("Index"));
            }

            ICollection <StudentSubject> studentSubjects = studentSubjectService
                                                           .GetStudentSubjectsByStudentId((int)id);

            Grade?averageGrade = studentSubjectService.GetStudentAverageGrade((int)id);

            Course course = studentService.GetStudentCourse((int)id);

            StudentAverageGradeViewModel viewModel = studentService
                                                     .CreateStudentAverageGradeViewModel(student, course, averageGrade);

            return(View(viewModel));
        }
Beispiel #2
0
        public ActionResult MySubjects(string email)
        {
            if (email == null)
            {
                return(RedirectToAction("Index"));
            }

            studentSubjectService = new StudentSubjectService();
            studentService        = new StudentService();
            courseService         = new CourseService();

            Student theStudent = studentService.GetStudentByName(email);

            if (theStudent == null)
            {
                return(RedirectToAction("Index"));
            }

            List <StudentSubject> studentSubjects = studentSubjectService
                                                    .GetStudentSubjectsByStudentId(theStudent.ID);

            Course studentCourse = courseService.GetStudentCourseByStudent(theStudent);

            List <StudentMySubjectsViewModel> viewModel = studentService
                                                          .CreateStudentMySubjectsViewModel(studentCourse, theStudent, studentSubjects);

            return(View(viewModel));
        }
Beispiel #3
0
        public ActionResult Grades(int?id)
        {
            if (id == null || !id.HasValue)
            {
                return(RedirectToAction("Index"));
            }

            studentSubjectService = new StudentSubjectService();

            List <StudentSubject> studentSubjects = studentSubjectService.GetStudentSubjectsByStudentId((int)id);

            if (studentSubjects.Count() == 0)
            {
                return(RedirectToAction("Index"));
            }

            return(View(studentSubjects));
        }