refactor: change Search of GetPaymentTransactions
This commit is contained in:
@@ -7,9 +7,9 @@
|
||||
public class GetPaymentTransactionListSearchModel
|
||||
{
|
||||
/// <summary>
|
||||
/// نام طرف قرارداد یا صاحب حساب بانکی جهت جستجو
|
||||
/// آیدی طرف حساب
|
||||
/// </summary>
|
||||
public string ContractingPartyOrAccountHolderName { get; set; }
|
||||
public long ContractingPartyId{ get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ شروع بازه جستجو (به صورت رشته)
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user