예제 #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));
        }
예제 #2
0
        // GET: Subject/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null || !id.HasValue)
            {
                return(RedirectToAction("Index"));
            }

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

            Subject subject = subjectService.getSubjectById((int)id);

            Teacher teacher = teacherService.GetTeacherBySubjectId((int)id);

            IEnumerable <StudentSubject> studentSubjects =
                studentSubjectService.FindStudentSubjectsBySubject(subject);

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

            List <TeacherStudentSubjectViewModel> viewModel = subjectService
                                                              .CreateTeacherStudentSubjectViewModel(subject, teacher, studentSubjects);

            return(View(viewModel));
        }
예제 #3
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));
        }
예제 #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            studentSubjectService = new StudentSubjectService();

            studentSubjectService.DeleteStudentSubjectById((int)id);

            return(RedirectToAction("Index"));
        }
예제 #5
0
        public StudentSubject UpdateStudentService(int id, StudentSubject studentSubject)
        {
            studentSubjectService = new StudentSubjectService();

            StudentSubject newStudentSubject = studentSubjectService.ChangeGrade(id, studentSubject);

            return(newStudentSubject);
        }
예제 #6
0
        public ActionResult Save(StudentSubject studentSubject)
        {
            studentSubjectService = new StudentSubjectService();

            var studentSubjectInDB = studentSubjectService.SaveStudentSubjectGrade(studentSubject);

            return(RedirectToAction("GradeStudents", "Teacher",
                                    new { SubjectTitle = studentSubjectInDB.Subject.Title }));
        }
예제 #7
0
        public ActionResult GradeStudents(int subjectID)
        {
            studentSubjectService = new StudentSubjectService();

            List <StudentSubject> studentSubjects = studentSubjectService
                                                    .GetAllStudentSubjectsRelatedToASubject(subjectID);

            return(View("AlternativeGradeStudents", studentSubjects));
        }
예제 #8
0
 public BaseController()
 {
     studentMoreService     = new StudentMoreService();
     studentSubjectService  = new StudentSubjectService();
     subjectService         = new SubjectService();
     errorLogDbService      = new ErrorLogDbService();
     studentService         = new StudentService();
     subjectModuleServivice = new SubjectModuleDbService();
 }
예제 #9
0
        public ActionResult Details(int?id)
        {
            studentSubjectService = new StudentSubjectService();

            if (id == null || !id.HasValue)
            {
                return(RedirectToAction("Index"));
            }

            StudentSubject studentSubject = studentSubjectService
                                            .GetStudentSubjectByStudentSubjectId((int)id);

            if (studentSubject == null)
            {
                return(RedirectToAction("Index"));
            }
            return(View(studentSubject));
        }
예제 #10
0
        public ActionResult SaveGrade(StudentSubject studentSubject)
        {
            if (studentSubject.Grade == null)
            {
                return(RedirectToAction("EditGrade",
                                        new { studentSubjectId = studentSubject.StudentSubjectID }));
            }

            studentSubjectService = new StudentSubjectService();
            teacherService        = new TeacherService();

            studentSubjectService.SaveGrade(studentSubject);

            Teacher teacher = teacherService
                              .GetTeacherByStudentSubjectId(studentSubject.StudentSubjectID);

            return(RedirectToAction("MyStudents", "Teacher", new { email = teacher.Email }));
        }
예제 #11
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));
        }
예제 #12
0
        public ActionResult EditGrade(int?studentSubjectId)
        {
            studentSubjectService = new StudentSubjectService();

            if (studentSubjectId == 0 || !studentSubjectId.HasValue)
            {
                return(RedirectToAction("Index"));
            }

            StudentSubject studentSubject = studentSubjectService
                                            .GetStudentSubjectByStudentSubjectId((int)studentSubjectId);

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

            return(View("EditGrade", studentSubject));
        }
예제 #13
0
        // GET: Student
        public ActionResult Index()
        {
            studentSubjectService = new StudentSubjectService();
            courseService         = new CourseService();
            studentService        = new StudentService();
            subjectService        = new SubjectService();

            List <StudentSubject> studentSubjects = studentSubjectService.GetAllStudentSubjects();

            IEnumerable <Subject> subjects = subjectService.GetSubjectsFromListOfStudentSubjects(studentSubjects);

            IEnumerable <Course> courses = courseService.GetCoursesFromListOfStudentSubjects(studentSubjects);

            IEnumerable <Student> students = studentService.GetStudentsByStudentSubjects(studentSubjects);

            List <CourseStudentSubjectViewModel> viewModel = studentService
                                                             .CreateCourseStudentSubjectViewModel(subjects, courses, students, studentSubjects);

            return(View(viewModel));
        }
예제 #14
0
        public ActionResult MyStudents(string email)
        {
            if (email == null)
            {
                return(RedirectToAction("Index"));
            }

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

            int teacherId = teacherService.GetTeacherIdFromEmail(email);

            List <Subject> subjectsTaught = subjectService.getSubjectsByTeacherId(teacherId);

            List <StudentSubject> studentSubjects = studentSubjectService
                                                    .GetStudentSubjectListFromALIstOfSubjects(subjectsTaught);

            return(View(studentSubjects));
        }
예제 #15
0
        public ActionResult DeleteConfirmed(int id)
        {
            uniService            = new UniversityStudentsListService();
            studentService        = new StudentService();
            studentSubjectService = new StudentSubjectService();

            if (id != 0)
            {
                // first remove student's studentsubjects
                studentSubjectService.RemoveStudentsStudentSubjectsByStudentId(id);

                // then set is enrolled to false in university students list
                uniService.SetIsEnrolledToFalseByStudentId(id);

                // and finally delete student from db.students
                studentService.DeleteStudentByStudentId(id);

                return(RedirectToAction("Index"));
            }

            return(RedirectToAction("Index"));
        }
예제 #16
0
 public SubjectController(StudentSubjectService studentSubjectService, StudentService studentService)
 {
     this.studentSubjectService = studentSubjectService;
     this.studentService        = studentService;
 }
예제 #17
0
 public StudentSubjectController(educacional.LayerInfrastructure.AppContext context)
 {
     _studentsubjectService = new StudentSubjectService(context);
 }
예제 #18
0
        public StudentSubject GetStudentSubject(int id)
        {
            studentSubjectService = new StudentSubjectService();

            return(studentSubjectService.GetStudentSubjectByStudentSubjectId(id));
        }
예제 #19
0
        public List <StudentSubject> GetAllStudentSubjects()
        {
            studentSubjectService = new StudentSubjectService();

            return(studentSubjectService.GetAllStudentSubjects());
        }