Esempio n. 1
0
        public async Task <ActionResult <IEnumerable <InstructorDto> > > GetAllInstructors()
        {
            var query  = new GetAllInstructorsQuery();
            var result = await _mediator.Send(query);

            return(Ok(result));
        }
            public async Task <List <InstructorDto> > Handle(GetAllInstructorsQuery request, CancellationToken cancellationToken)
            {
                List <Instructor> instructors = await _context.Instructors.Include(a => a.ClassInstructors).ThenInclude(a => a.Class)
                                                .ToListAsync(cancellationToken);

                var dtos = _mapper.Map <List <InstructorDto> >(instructors);

                return(dtos);
            }
 public async Task <IEnumerable <InstructorDto> > Handle(GetAllInstructorsQuery request, CancellationToken cancellationToken)
 {
     return(await repository.Instructor.GetInstructorsAsync());
 }