From 68c5021085a07fb3caa28975eb2aeceb11545286 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 6 May 2025 17:38:51 +0530 Subject: [PATCH] Added condition to only fetch attendance record between dateFrom and dateTo --- Marco.Pms.Services/Controllers/AttendanceController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/AttendanceController.cs b/Marco.Pms.Services/Controllers/AttendanceController.cs index 5ef92d0..baa7ce7 100644 --- a/Marco.Pms.Services/Controllers/AttendanceController.cs +++ b/Marco.Pms.Services/Controllers/AttendanceController.cs @@ -91,7 +91,7 @@ namespace MarcoBMS.Services.Controllers _logger.LogError("The employee Id sent by user is empty"); return BadRequest(ApiResponse.ErrorResponse("Employee ID is required and must not be Empty.", "Employee ID is required and must not be empty.", 400)); } - List attendances = await _context.Attendes.Where(c => c.EmployeeID == employeeId && c.TenantId == TenantId).ToListAsync(); + List attendances = await _context.Attendes.Where(c => c.EmployeeID == employeeId && c.TenantId == TenantId && c.AttendanceDate.Date >= fromDate && c.AttendanceDate.Date <= toDate).ToListAsync(); Employee? employee = await _context.Employees.Include(e => e.JobRole).FirstOrDefaultAsync(e => e.Id == employeeId && e.TenantId == TenantId && e.IsActive); List results = new List();