using Diligent.WebAPI.Contracts.DTOs.Schedule; namespace Diligent.WebAPI.Business.Services { public class ScheduleService : IScheduleService { private readonly DatabaseContext _context; private readonly IMapper _mapper; private readonly ILogger _logger; public ScheduleService(DatabaseContext context, IMapper mapper,ILogger logger) { _context = context; _mapper = mapper; _logger = logger; } public async Task> GetScheduleForCertainPeriod(int month, int year) { _logger.LogInformation("Start getting schedule for certain period"); _logger.LogInformation("Getting data from DB and filter"); var selectionProcessess = await _context.SelectionProcesses .Include(c => c.Applicant) .Include(c => c.SelectionLevel) .Where(k => k.Date != null && k.Date.Value.Month == month && k.Date.Value.Year == year) .ToListAsync(); _logger.LogInformation($"Got {selectionProcessess.Count} selection processes"); _logger.LogInformation($"Return schedule for certain period"); return _mapper.Map>(selectionProcessess); } } }