public Task <List <SchoolYearListResponse> > Handle(StudentSchoolYearListQuery request, CancellationToken cancellationToken) { return(context.Students.Where(x => x.Id == request.StudentId) .SelectMany(x => x.Class.ClassSchoolYears.Select(x => x.SchoolYear)) .ProjectTo <SchoolYearListResponse>(configurationProvider) .ToListAsync(cancellationToken)); }
public Task <List <ClassRegisterItemResponse> > Handle(StudentSchoolYearListQuery request, CancellationToken cancellationToken) { var currentUserId = identityService.GetCurrentUserId(); return(context.ClassSchoolYearSubjects.Where(x => x.ClassSchoolYearSubjectStudents.Any(t => t.Student.UserId == currentUserId)) .Select(x => x.SchoolYear) .Distinct() .OrderBy(x => x.Name) .ProjectTo <ClassRegisterItemResponse>(configurationProvider) .ToListAsync(cancellationToken)); }