public List <StudentDto> GetAll() { var students = _studentRepository.FindBy(c => c.IsDeleted == false); var result = students.Select(c => StudentMapper.StudentToStudentDto(c)).ToList(); return(result); }
public StudentDto GetStudentById(int id) { var student = _studentRepository.Find(id); var result = StudentMapper.StudentToStudentDto(student); return(result); }
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); }