using Diligent.WebAPI.Contracts.DTOs.SelectionLevel; using Diligent.WebAPI.Contracts.DTOs.SelectionProcess; namespace Diligent.WebAPI.Business.Services { public class SelectionLevelService : ISelectionLevelService { private readonly DatabaseContext _context; private readonly IMapper _mapper; public SelectionLevelService(DatabaseContext context, IMapper mapper) { _context = context; _mapper = mapper; } public async Task> GetAllAsync() => _mapper.Map>(await _context.SelectionLevels.Include(sl => sl.SelectionProcesses).ToListAsync()); public async Task GetByIdAsync(int id) { var sl = await _context.SelectionLevels.FindAsync(id); if (sl is null) throw new EntityNotFoundException("Selection level not found"); return _mapper.Map(sl); } } }