123456789101112131415161718192021222324252627282930 |
- using Microsoft.EntityFrameworkCore;
- using MTWorkHR.Core.Entities;
- using MTWorkHR.Core.IDto;
- using MTWorkHR.Core.IRepositories;
- using MTWorkHR.Infrastructure.Entities;
- using MTWorkHR.Infrastructure.DBContext;
- namespace MTWorkHR.Infrastructure.Repositories
- {
- public class UserTaskRepository : Repository<UserTask>, IUserTaskRepository
- {
- private readonly DbSet<UserTask> dbSet;
- public UserTaskRepository(HRDataContext context) : base(context)
- {
- dbSet = context.Set<UserTask>();
- }
- public async Task<UserTask> GetByIdWithAllChildren(long id)
- {
- return await dbSet
- .Include(x => x.TaskAttachments).ThenInclude(a => a.AttachmentType)
- .Include(x => x.UserTaskHistories)
- .Include(x => x.TaskStatus)
- .Include(x => x.Project)
- .FirstOrDefaultAsync(x => x.Id == id);
- }
- }
- }
|