|
|
|
@@ -30,8 +30,12 @@ |
|
|
|
} |
|
|
|
public async Task<List<AdResponseWithCountDto>> GetAllWithCountAsync() |
|
|
|
{ |
|
|
|
_logger.LogInformation("Start getting all Ads with applicants count"); |
|
|
|
var today = DateTime.Now; |
|
|
|
return _mapper.Map<List<AdResponseWithCountDto>>(await _context.Ads.Include(x => x.Applicants).Where(x => x.ExpiredAt > today).ToListAsync()); |
|
|
|
_logger.LogInformation("Getting data from database"); |
|
|
|
var res = _mapper.Map<List<AdResponseWithCountDto>>(await _context.Ads.Include(x => x.Applicants).Where(x => x.ExpiredAt > today).ToListAsync()); |
|
|
|
_logger.LogInformation($"Received {res.Count} ads with their counts"); |
|
|
|
return res; |
|
|
|
} |
|
|
|
public async Task<AdResponseDto> GetByIdAsync(int id) |
|
|
|
{ |