Exemple #1
0
        public async Task <List <StudentGithubDto> > ExecuteQueryAsync(GetStudentsGithubQuery contract)
        {
            var studentsInCourse =
                await students.Where(s =>
                                     s.Courses.Any(c => c.CourseId == contract.CourseId))
                .ToListAsync();

            return(studentsInCourse.Select(GetStudentsGitHubDetails).ToList());
        }
 public List <StudentGithubDto> ExecuteQuery(GetStudentsGithubQuery contract)
 {
     return
         (courses.SingleOrDefault(c => c.CourseId == contract.CourseId)
          ?.Students
          ?.Select(sc => sc.Student)
          .Select(GetStudentsGitHubDetails)
          .ToList()
          ?? new List <StudentGithubDto>());
 }