LookupService.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using Microsoft.AspNetCore.Identity;
  2. using Microsoft.AspNetCore.WebUtilities;
  3. using Microsoft.EntityFrameworkCore;
  4. using Microsoft.Extensions.Configuration;
  5. using MTWorkHR.Application.Identity;
  6. using MTWorkHR.Application.Mapper;
  7. using MTWorkHR.Application.Models;
  8. using MTWorkHR.Core.Global;
  9. using MTWorkHR.Core.IRepositories;
  10. using MTWorkHR.Core.UnitOfWork;
  11. using MTWorkHR.Infrastructure.Entities;
  12. using MTWorkHR.Application.Services.Interfaces;
  13. using MTWorkHR.Core.Email;
  14. using MTWorkHR.Core.Entities;
  15. using MTWorkHR.Infrastructure.UnitOfWorks;
  16. using MTWorkHR.Core.IDto;
  17. using MTWorkHR.Infrastructure.Repositories;
  18. namespace MTWorkHR.Application.Services
  19. {
  20. public class LookupService : ILookupService
  21. {
  22. private readonly IUnitOfWork _unitOfWork;
  23. public LookupService(IUnitOfWork unitOfWork)
  24. {
  25. _unitOfWork = unitOfWork;
  26. }
  27. public async Task<List<LeaveTypeDto>> GetAllLeaveType()
  28. {
  29. var result = await _unitOfWork.LeaveType.GetAllAsync();
  30. var list = MapperObject.Mapper.Map<List<LeaveTypeDto>>(result.Item1);
  31. return list;
  32. }
  33. public async Task<List<OrderTypeDto>> GetAllOrderType()
  34. {
  35. var entity = await _unitOfWork.OrderType.GetAllAsync();
  36. var response = MapperObject.Mapper.Map<List<OrderTypeDto>>(entity.Item1);
  37. return response;
  38. }
  39. }
  40. }