diff --git a/CompanyManagment.App.Contracts/Loan/LoanSearchViewModel.cs b/CompanyManagment.App.Contracts/Loan/LoanSearchViewModel.cs index f1bf0c5a..8a5b5b8b 100644 --- a/CompanyManagment.App.Contracts/Loan/LoanSearchViewModel.cs +++ b/CompanyManagment.App.Contracts/Loan/LoanSearchViewModel.cs @@ -16,5 +16,6 @@ public class LoanSearchViewModel public string EndDate { get; set; } public int PageIndex { get; set; } + public int PageSize { get; set; } = 30; public bool ShowAsGrouped { get; set; } } diff --git a/CompanyManagment.EFCore/Repository/LoanRepository.cs b/CompanyManagment.EFCore/Repository/LoanRepository.cs index 05c681e7..fdcd58d0 100644 --- a/CompanyManagment.EFCore/Repository/LoanRepository.cs +++ b/CompanyManagment.EFCore/Repository/LoanRepository.cs @@ -171,7 +171,7 @@ public class LoanRepository : RepositoryBase, ILoanRepository query = query.Where(x => x.StartInstallmentPayment >= startDate && x.StartInstallmentPayment <= endDate); } - result.LoanListViewModel = query.OrderByDescending(x => x.StartInstallmentPayment).Skip(searchModel.PageIndex) + result.LoanListViewModel = query.OrderByDescending(x => x.StartInstallmentPayment).ApplyPagination(searchModel.PageIndex,searchModel.PageSize) .Take(30).ToList() .Select(x => new LoanViewModel() {