public async Task <IEnumerable <JobDto> > Handle(GetJobsQuery request, CancellationToken cancellationToken)
 {
     return(await _context.Jobs
            .OrderBy(o => o.CreationDateTime)
            .ProjectTo <JobDto>(_mapper.ConfigurationProvider)
            .ToListAsync(cancellationToken));
 }
Esempio n. 2
0
        public async Task <IEnumerable <JobDto> > Handle(GetJobsQuery request, CancellationToken cancellationToken)
        {
            var jobs = await _dbContext.Jobs
                       .WithSpecification(new JobCommonSpecifications())
                       .ProjectTo <JobEntity>(_mapper.ConfigurationProvider)
                       .AsNoTracking()
                       .ToListAsync(cancellationToken: cancellationToken);

            return(_mapper.Map <IEnumerable <JobDto> >(jobs));
        }
Esempio n. 3
0
        public async Task <IActionResult> GetAll()
        {
            var query = new GetJobsQuery();

            var result = await _mediator.Send(query);

            if (result.Success)
            {
                return(Ok(result));
            }

            return(BadRequest(result));
        }
Esempio n. 4
0
 public JobBase()
 {
     _getJobsQuery = new GetJobsQuery();
 }