public async Task <PagenatedList <CourseDto> > Handle(GetProducedCoursesQuery request, CancellationToken cancellationToken) { var queriable = _courseRepo.GetQueryable() .Where(x => x.TeacherId == _workContext.CurrentUserId) .Include(x => x.Teacher) .Include(x => x.CourseCategory) .Include(x => x.Contents) .Include(x => x.Lessons).ThenInclude(x => x.Lesson) .Include(x => x.Lessons).ThenInclude(x => x.Lesson.Lesson) .Include(x => x.Lessons).ThenInclude(x => x.Lesson.Field) .Include(x => x.Lessons).ThenInclude(x => x.Lesson.Grade); return(new PagenatedList <CourseDto> { AllCount = queriable.Count(), Items = queriable.Pagenate(request).Select(CourseProfile.Projection).ToList() }); }
public async Task <ActionResult <PagenatedList <CourseDto> > > GetProducedCourses(GetProducedCoursesQuery query) { return(Ok(await _mediator.Send(query))); }