1234567891011121314151617181920212223242526272829 |
- 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 AttendanceRepository : Repository<Attendance>, IAttendanceRepository
- {
- private readonly DbSet<Attendance> dbSet;
- public AttendanceRepository(HRDataContext context) : base(context)
- {
- dbSet = context.Set<Attendance>();
- }
-
- public async Task<Attendance> GetAttendanceByUserId(string userId, DateTime attendanceDate)
- {
- var result = await dbSet
- .FirstOrDefaultAsync(x => x.UserId == userId && x.AttendanceDate.Date == attendanceDate.Date);
- return result;
- }
- }
- }
|