parent
3b054f21cc
commit
54e2a3f8b6
1 changed files with 7 additions and 5 deletions
|
|
@ -106,18 +106,20 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
||||||
|
|
||||||
public async Task<List<LeaveRequest>> GetLeaveRequestForAdminAsync(int year, Guid type, string status)
|
public async Task<List<LeaveRequest>> GetLeaveRequestForAdminAsync(int year, Guid type, string status)
|
||||||
{
|
{
|
||||||
var rawData = _dbContext.Set<LeaveRequest>().AsQueryable()
|
var rawData = _dbContext.Set<LeaveRequest>()
|
||||||
.Include(x => x.Type);
|
.Include(x => x.Type)
|
||||||
|
.AsQueryable();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (year != 0)
|
if (year != 0)
|
||||||
rawData = (IIncludableQueryable<LeaveRequest, LeaveType>)rawData.Where(x => x.LeaveStartDate.Year == year);
|
rawData = rawData.Where(x => x.LeaveStartDate.Year == year);
|
||||||
|
|
||||||
if (type != Guid.Empty)
|
if (type != Guid.Empty)
|
||||||
rawData = (IIncludableQueryable<LeaveRequest, LeaveType>)rawData.Where(x => x.Type.Id == type);
|
rawData = rawData.Where(x => x.Type.Id == type);
|
||||||
|
|
||||||
if (status.Trim().ToUpper() != "ALL")
|
if (status.Trim().ToUpper() != "ALL")
|
||||||
rawData = (IIncludableQueryable<LeaveRequest, LeaveType>)rawData.Where(x => x.LeaveStatus == status);
|
rawData = rawData.Where(x => x.LeaveStatus == status);
|
||||||
|
|
||||||
return await rawData.ToListAsync();
|
return await rawData.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue