refactor: change Search of GetPaymentTransactions

This commit is contained in:
MahanCh
2025-07-16 14:31:43 +03:30
parent 558021ac6a
commit 0cb9cfe9b2
2 changed files with 5 additions and 6 deletions

View File

@@ -7,9 +7,9 @@
public class GetPaymentTransactionListSearchModel
{
/// <summary>
/// نام طرف قرارداد یا صاحب حساب بانکی جهت جستجو
/// آیدی طرف حساب
/// </summary>
public string ContractingPartyOrAccountHolderName { get; set; }
public long ContractingPartyId{ get; set; }
/// <summary>
/// تاریخ شروع بازه جستجو (به صورت رشته)

View File

@@ -10,7 +10,7 @@ using Microsoft.EntityFrameworkCore;
namespace CompanyManagment.EFCore.Repository;
public class PaymentTransactionRepository:RepositoryBase<long, PaymentTransaction>,IPaymentTransactionRepository
public class PaymentTransactionRepository : RepositoryBase<long, PaymentTransaction>, IPaymentTransactionRepository
{
private readonly CompanyContext _companyContext;
public PaymentTransactionRepository(CompanyContext companyContext) : base(companyContext)
@@ -22,10 +22,9 @@ public class PaymentTransactionRepository:RepositoryBase<long, PaymentTransactio
{
var query = _companyContext.PaymentTransactions.AsQueryable();
if (!string.IsNullOrWhiteSpace(searchModel.ContractingPartyOrAccountHolderName))
if (searchModel.ContractingPartyId > 0)
{
query = query.Where(x=>searchModel.ContractingPartyOrAccountHolderName.Contains(x.ContractingPartyName)||
searchModel.ContractingPartyOrAccountHolderName.Contains(x.BankAccountHolderName));
query = query.Where(x => x.ContractingPartyId == searchModel.ContractingPartyId);
}
if (!string.IsNullOrWhiteSpace(searchModel.FromDate) && !string.IsNullOrWhiteSpace(searchModel.ToDate))