change compare LeaveStatus to Contain
This commit is contained in:
parent
c6619f1253
commit
00ffa455fd
2 changed files with 3 additions and 1 deletions
|
|
@ -572,11 +572,12 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public async Task<bool> CheckDuplicateLeave(Guid keycloakUserId, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
var leaveStatus = new List<string>() { "NEW", "PENDING", "APPROVE" };
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.LeaveStartDate.Date == startDate.Date || x.LeaveEndDate.Date == endDate.Date)
|
||||
.Where(x => x.LeaveStatus == "NEW" || x.LeaveStatus == "PENDING" || x.LeaveStatus == "APPROVE")
|
||||
.Where(x => leaveStatus.Contains(x.LeaveStatus))
|
||||
.ToListAsync();
|
||||
|
||||
return data.Count > 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue