Exemple #1
0
        public ActionResult MySubjects(string email)
        {
            if (email == null)
            {
                return(RedirectToAction("Index"));
            }

            subjectService = new SubjectService();
            teacherService = new TeacherService();

            int teacherId = teacherService.GetTeacherIdFromEmail(email);

            Teacher teacher = teacherService.GetTeacherById(teacherId);

            IEnumerable <Subject> teacherSubjects = subjectService.getSubjectsByTeacherId(teacherId);

            if (teacher == null || teacherSubjects == null)
            {
                return(RedirectToAction("Index"));
            }

            List <TeacherSubjectNumberOfStudentsViewModel> viewModel = teacherService
                                                                       .CreateTeacherSubjectNumberOfStudentsViewModel(teacher, teacherSubjects);

            return(View(viewModel));
        }