using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Diligent.WebAPI.Business.Services { public class TechnologyService : ITechnologyService { private readonly DatabaseContext _context; private readonly IMapper _mapper; public TechnologyService(IMapper mapper, DatabaseContext context) { _mapper = mapper; _context = context; } public async Task> GetAllAsync() => _mapper.Map>(await _context.Technologies.ToListAsync()); public async Task GetByIdAsync(int id) { var technology = await _context.Technologies.FindAsync(id); if (technology is null) throw new EntityNotFoundException("Technology not found"); return _mapper.Map(technology); } } }