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)
|
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()
|
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||||
.Include(x => x.Type)
|
.Include(x => x.Type)
|
||||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||||
.Where(x => x.LeaveStartDate.Date == startDate.Date || x.LeaveEndDate.Date == endDate.Date)
|
.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();
|
.ToListAsync();
|
||||||
|
|
||||||
return data.Count > 0;
|
return data.Count > 0;
|
||||||
|
|
|
||||||
|
|
@ -1563,6 +1563,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
return Error("Document not found");
|
return Error("Document not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue