| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- 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<List<TechnologyResponseDto>> GetAllAsync() =>
- _mapper.Map<List<TechnologyResponseDto>>(await _context.Technologies.ToListAsync());
-
- public async Task<List<TechnologyApplicantViewDto>> GetAllAsync2() =>
- _mapper.Map<List<TechnologyApplicantViewDto>>(await _context.Technologies.ToListAsync());
-
-
- public async Task<TechnologyResponseDto> GetByIdAsync(int id)
- {
- var technology = await _context.Technologies.FindAsync(id);
-
- if (technology is null)
- throw new EntityNotFoundException("Technology not found");
-
- return _mapper.Map<TechnologyResponseDto>(technology);
- }
-
- public async Task<TechnologyApplicantViewDto> GetByIdAsync2(int id)
- {
- var technology = await _context.Technologies.FindAsync(id);
-
- if (technology is null)
- throw new EntityNotFoundException("Technology not found");
-
- return _mapper.Map<TechnologyApplicantViewDto>(technology);
- }
- }
- }
|