public IEnumerable <LectureBL> GetLectures()
        {
            var lisLecture = new List <LectureBL>();

            _lectureRepository.GetLectures().ToList().ForEach(a => lisLecture.Add(_mapper.Map <LectureBL>(a)));
            return(lisLecture);
        }
Esempio n. 2
0
        public IEnumerable <GetLectureDTO> GetLectures(int userId, string role)
        {
            IEnumerable <Lecture> lectureEntites;

            if (role == "teacher")
            {
                lectureEntites = _repository.GetLecturesOfTeacher(userId);
            }
            else
            {
                lectureEntites = _repository.GetLectures();
            }

            return(Mapper.Map <IEnumerable <GetLectureDTO> >(lectureEntites));
        }
Esempio n. 3
0
 public IEnumerable <LectureDto> GetLectures()
 {
     return(_repo.GetLectures());
 }
Esempio n. 4
0
        public void FillDatabaseTestData()
        {
            _educationRepository.EnsureDeleted();
            _educationRepository.EnsureCreated();
            List <Student> students = new List <Student>()
            {
                new Student()
                {
                    FullName = "Ivan Ivanov", EMail = "*****@*****.**", Phone = "123456"
                },
                new Student()
                {
                    FullName = "Nikolai Ivanov", EMail = "*****@*****.**", Phone = "123456"
                },
                new Student()
                {
                    FullName = "Serdei Ivanov", EMail = "*****@*****.**", Phone = "123456"
                },
                new Student()
                {
                    FullName = "Petr Ivanov", EMail = "*****@*****.**", Phone = "123456"
                }
            };
            IStudentRepository studentRepository = _educationRepository.GetStudentRepository();

            students.ForEach(s => studentRepository.InsertStudent(s));
            studentRepository.Save();
            List <Lecturer> lecturers = new List <Lecturer>()
            {
                new Lecturer()
                {
                    FullName = "Sergei Petrov"
                }, new Lecturer()
                {
                    FullName = "Nick Petrov"
                }
            };
            ILecturerRepository lecturerRepository = _educationRepository.GetLecturerRepository();

            lecturers.ForEach(l => lecturerRepository.InsertLecturer(l));
            lecturerRepository.Save();
            List <Lecture> lectures = new List <Lecture> {
                new Lecture()
                {
                    Title = "Jamping", Lecturer = lecturerRepository.GetLecturers().First()
                },
                new Lecture()
                {
                    Title = "Riding", Lecturer = lecturerRepository.GetLecturers().First()
                },
                new Lecture()
                {
                    Title = "Joging", Lecturer = lecturerRepository.GetLecturers().First()
                },
                new Lecture()
                {
                    Title = "Climbing", Lecturer = lecturerRepository.GetLecturers().Last()
                }
            };
            ILectureRepository lectureRepository = _educationRepository.GetLectureRepository();

            lectures.ForEach(l => lectureRepository.InsertLecture(l));
            lectureRepository.Save();
            List <AttendingLecture> attendingLectures = new List <AttendingLecture> {
                new AttendingLecture()
                {
                    Atended = false, Lecture = lectureRepository.GetLectures().ToList()[0], Student = studentRepository.GetStudents().ToList()[0]
                },
                new AttendingLecture()
                {
                    Atended = false, Lecture = lectureRepository.GetLectures().ToList()[1], Student = studentRepository.GetStudents().ToList()[0]
                },
                new AttendingLecture()
                {
                    Atended = false, Lecture = lectureRepository.GetLectures().ToList()[2], Student = studentRepository.GetStudents().ToList()[0]
                },
                new AttendingLecture()
                {
                    Atended = false, Lecture = lectureRepository.GetLectures().ToList()[3], Student = studentRepository.GetStudents().ToList()[0]
                },

                new AttendingLecture()
                {
                    Atended = true, Lecture = lectureRepository.GetLectures().ToList()[0], Student = studentRepository.GetStudents().ToList()[1]
                },
                new AttendingLecture()
                {
                    Atended = true, Lecture = lectureRepository.GetLectures().ToList()[1], Student = studentRepository.GetStudents().ToList()[1]
                },
                new AttendingLecture()
                {
                    Atended = true, Lecture = lectureRepository.GetLectures().ToList()[2], Student = studentRepository.GetStudents().ToList()[1]
                },
                new AttendingLecture()
                {
                    Atended = false, Lecture = lectureRepository.GetLectures().ToList()[3], Student = studentRepository.GetStudents().ToList()[1]
                },

                new AttendingLecture()
                {
                    Atended = false, Lecture = lectureRepository.GetLectures().Last(), Student = studentRepository.GetStudents().Last()
                }
            };
            IAttendingLectureRepository attendingLectureRepository = _educationRepository.GetAttendingLectureRepository();

            attendingLectures.ForEach(a => attendingLectureRepository.InsertAttendingLecture(a));
            attendingLectureRepository.Save();
            attendingLectures = attendingLectureRepository.GetAttendingLectures().ToList();
            List <HomeWork> homeWorks = new List <HomeWork> {
                new HomeWork()
                {
                    AttendingLecture = attendingLectures[0], CourseGrade = 0
                },
                new HomeWork()
                {
                    AttendingLecture = attendingLectures[1], CourseGrade = 1
                },
                new HomeWork()
                {
                    AttendingLecture = attendingLectures[2], CourseGrade = 2
                },
                new HomeWork()
                {
                    AttendingLecture = attendingLectures[3], CourseGrade = 3
                },
                new HomeWork()
                {
                    AttendingLecture = attendingLectures[4], CourseGrade = 4
                },
                new HomeWork()
                {
                    AttendingLecture = attendingLectures[5], CourseGrade = 4
                },
                new HomeWork()
                {
                    AttendingLecture = attendingLectures[6], CourseGrade = 4
                },
                new HomeWork()
                {
                    AttendingLecture = attendingLectures[7], CourseGrade = 4
                },
                new HomeWork()
                {
                    AttendingLecture = attendingLectures[8], CourseGrade = 1
                },
            };



            IHomeWorkRepository homeWorkRepository = _educationRepository.GetHomeWorkRepository();

            homeWorks.ForEach(h => homeWorkRepository.InsertHomeWork(h));
            homeWorkRepository.Save();
        }
Esempio n. 5
0
        public IEnumerable <Lecture> Get()
        {
            _log.Info("Get all the lectures.");

            return(lectureRepo.GetLectures());
        }
Esempio n. 6
0
 public List <Lecture> GetLectures()
 {
     return(_lectureRepository.GetLectures());
 }