コード例 #1
0
        public List <StudentDto> GetAll()
        {
            var students = _studentRepository.FindBy(c => c.IsDeleted == false);
            var result   = students.Select(c => StudentMapper.StudentToStudentDto(c)).ToList();

            return(result);
        }
コード例 #2
0
        public StudentDto GetStudentById(int id)
        {
            var student = _studentRepository.Find(id);
            var result  = StudentMapper.StudentToStudentDto(student);

            return(result);
        }
コード例 #3
0
        public List <StudentDto> GetCourseStudents(int id)
        {
            var course   = _courseRepository.Find(id);
            var students = _courseStudentRepository.FindByIncluding(t => t.CourseId == course.Id, t => t.Student);
            var result   = new List <StudentDto>();

            foreach (var cs in students)
            {
                var dto = StudentMapper.StudentToStudentDto(cs.Student);
                result.Add(dto);
            }

            return(result);
        }