|
@@ -13,6 +13,7 @@ using MTWorkHR.Application.Services.Interfaces;
|
|
using MTWorkHR.Core.Email;
|
|
using MTWorkHR.Core.Email;
|
|
using MTWorkHR.Core.Entities;
|
|
using MTWorkHR.Core.Entities;
|
|
using MTWorkHR.Infrastructure.UnitOfWorks;
|
|
using MTWorkHR.Infrastructure.UnitOfWorks;
|
|
|
|
+using System.Linq.Dynamic.Core;
|
|
|
|
|
|
namespace MTWorkHR.Application.Services
|
|
namespace MTWorkHR.Application.Services
|
|
{
|
|
{
|
|
@@ -84,6 +85,38 @@ namespace MTWorkHR.Application.Services
|
|
var response = Mapper.MapperObject.Mapper.Map<ProjectDto>(entity);
|
|
var response = Mapper.MapperObject.Mapper.Map<ProjectDto>(entity);
|
|
return response;
|
|
return response;
|
|
}
|
|
}
|
|
|
|
+ public override async Task<PagingResultDto<ProjectDto>> GetAll(PagingInputDto PagingInputDto)
|
|
|
|
+ {
|
|
|
|
+ var res = await _unitOfWork.Project.GetAllWithChildrenAsync();
|
|
|
|
+ var query = res.Item1;
|
|
|
|
+
|
|
|
|
+ if (PagingInputDto.HiddenFilter != null)
|
|
|
|
+ {
|
|
|
|
+ query = query.Where(PagingInputDto.HiddenFilter);
|
|
|
|
+ }
|
|
|
|
+ if (PagingInputDto.Filter != null)
|
|
|
|
+ {
|
|
|
|
+ var filter = PagingInputDto.Filter;
|
|
|
|
+ query = query.Where(u => u.NameAr.Contains(filter));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var order = query.OrderBy(PagingInputDto.OrderByField + " " + PagingInputDto.OrderType);
|
|
|
|
+
|
|
|
|
+ var page = order.Skip((PagingInputDto.PageNumber * PagingInputDto.PageSize) - PagingInputDto.PageSize).Take(PagingInputDto.PageSize);
|
|
|
|
+
|
|
|
|
+ var total = await query.CountAsync();
|
|
|
|
+
|
|
|
|
+ var list = MapperObject.Mapper
|
|
|
|
+ .Map<IList<ProjectDto>>(await page.ToListAsync());
|
|
|
|
+
|
|
|
|
+ var response = new PagingResultDto<ProjectDto>
|
|
|
|
+ {
|
|
|
|
+ Result = list,
|
|
|
|
+ Total = total
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ return response;
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|