コード例 #1
0
        public CourseDto GetCourseById(int id)
        {
            var course = _courseRepository.Find(id);
            var result = CourseMapper.CourseToCourseDto(course);

            return(result);
        }
コード例 #2
0
        public List <CourseDto> GetCourseStudents(int id)
        {
            var student = _studentRepository.Find(id);
            var courses = _courseStudentRepository.FindByIncluding(t => t.StudentId == student.Id, t => t.Course);

            var result = courses.Select(cs => CourseMapper.CourseToCourseDto(cs.Course)).ToList();

            return(result);
        }
コード例 #3
0
        public List <CourseDto> GetAll()
        {
            var result = new List <CourseDto>();
            //var courses = _courseRepository.GetAll();
            var courses = _courseRepository.FindBy(c => c.IsDeleted == false);

            foreach (var c in courses)
            {
                var dto = CourseMapper.CourseToCourseDto(c);
                result.Add(dto);
            }

            return(result);
        }