OrderRequestRepository.cs 823 B

123456789101112131415161718192021222324252627
  1. using Microsoft.EntityFrameworkCore;
  2. using MTWorkHR.Core.Entities;
  3. using MTWorkHR.Core.IDto;
  4. using MTWorkHR.Core.IRepositories;
  5. using MTWorkHR.Infrastructure.Entities;
  6. using MTWorkHR.Infrastructure.DBContext;
  7. using MTWorkHR.Core.Entities.User;
  8. namespace MTWorkHR.Infrastructure.Repositories
  9. {
  10. public class OrderRequestRepository : Repository<OrderRequest>, IOrderRequestRepository
  11. {
  12. private readonly DbSet<OrderRequest> dbSet;
  13. public OrderRequestRepository(HRDataContext context) : base(context)
  14. {
  15. dbSet = context.Set<OrderRequest>();
  16. }
  17. public async Task<OrderRequest> GetByIdWithAllChildren(long id)
  18. {
  19. return await dbSet
  20. .Include(x => x.OrderType)
  21. .FirstOrDefaultAsync(x => x.Id == id);
  22. }
  23. }
  24. }