fix: update TotalCount calculation in PagedResult to use correct count from plans
This commit is contained in:
@@ -329,8 +329,10 @@ public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IP
|
||||
InstitutionPlanSearchModel searchModel)
|
||||
{
|
||||
var planPercentage = await _context.PlanPercentages.FirstOrDefaultAsync();
|
||||
|
||||
if (planPercentage == null)
|
||||
return new PagedResult<InstitutionPlanListDto>();
|
||||
|
||||
var dailyWageYearlySalery = await _context.YearlySalaries.Include(i => i.YearlySalaryItemsList).FirstOrDefaultAsync(x =>
|
||||
x.StartDate.Date <= DateTime.Now.Date && x.EndDate >= DateTime.Now.Date);
|
||||
if (dailyWageYearlySalery == null)
|
||||
@@ -343,6 +345,7 @@ public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IP
|
||||
if (searchModel.CountPeron > 0)
|
||||
plans = plans.Where(x => x.CountPerson == searchModel.CountPeron);
|
||||
|
||||
var count = await plans.CountAsync();
|
||||
var planQueryFilter =await plans.ApplyPagination(searchModel.PageIndex, searchModel.PageSize).ToListAsync();
|
||||
var planResult = planQueryFilter.Select(plan =>
|
||||
new InstitutionPlanViewModel
|
||||
@@ -403,7 +406,7 @@ public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IP
|
||||
|
||||
return new PagedResult<InstitutionPlanListDto>()
|
||||
{
|
||||
TotalCount = finalResult.Count,
|
||||
TotalCount = count,
|
||||
List = finalResult
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user