// 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)); }
// 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)); }
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)); }
public ActionResult DeleteConfirmed(int id) { studentSubjectService = new StudentSubjectService(); studentSubjectService.DeleteStudentSubjectById((int)id); return(RedirectToAction("Index")); }
public StudentSubject UpdateStudentService(int id, StudentSubject studentSubject) { studentSubjectService = new StudentSubjectService(); StudentSubject newStudentSubject = studentSubjectService.ChangeGrade(id, studentSubject); return(newStudentSubject); }
public ActionResult Save(StudentSubject studentSubject) { studentSubjectService = new StudentSubjectService(); var studentSubjectInDB = studentSubjectService.SaveStudentSubjectGrade(studentSubject); return(RedirectToAction("GradeStudents", "Teacher", new { SubjectTitle = studentSubjectInDB.Subject.Title })); }
public ActionResult GradeStudents(int subjectID) { studentSubjectService = new StudentSubjectService(); List <StudentSubject> studentSubjects = studentSubjectService .GetAllStudentSubjectsRelatedToASubject(subjectID); return(View("AlternativeGradeStudents", studentSubjects)); }
public BaseController() { studentMoreService = new StudentMoreService(); studentSubjectService = new StudentSubjectService(); subjectService = new SubjectService(); errorLogDbService = new ErrorLogDbService(); studentService = new StudentService(); subjectModuleServivice = new SubjectModuleDbService(); }
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)); }
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 })); }
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)); }
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)); }
// 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)); }
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)); }
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")); }
public SubjectController(StudentSubjectService studentSubjectService, StudentService studentService) { this.studentSubjectService = studentSubjectService; this.studentService = studentService; }
public StudentSubjectController(educacional.LayerInfrastructure.AppContext context) { _studentsubjectService = new StudentSubjectService(context); }
public StudentSubject GetStudentSubject(int id) { studentSubjectService = new StudentSubjectService(); return(studentSubjectService.GetStudentSubjectByStudentSubjectId(id)); }
public List <StudentSubject> GetAllStudentSubjects() { studentSubjectService = new StudentSubjectService(); return(studentSubjectService.GetAllStudentSubjects()); }