From 4b24ac5ae903529795896b6904971b5cb3dfdefd Mon Sep 17 00:00:00 2001 From: Zakharov_Rostislav Date: Sat, 25 May 2024 22:53:28 +0400 Subject: [PATCH] fix transfer filtration --- Bank/BankContracts/SearchModels/TransferSearchModel.cs | 2 +- Bank/BankDatabaseImplement/Implements/TransferStorage.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Bank/BankContracts/SearchModels/TransferSearchModel.cs b/Bank/BankContracts/SearchModels/TransferSearchModel.cs index 6906ced..f7fd3cc 100644 --- a/Bank/BankContracts/SearchModels/TransferSearchModel.cs +++ b/Bank/BankContracts/SearchModels/TransferSearchModel.cs @@ -14,6 +14,6 @@ namespace BankContracts.SearchModels public int? OperationId { get; set; } public int? SenderAccountId { get; set; } public int? RecipientAccountId { get; set; } - public int ManagerId { get; set; } + public int? ManagerId { get; set; } } } diff --git a/Bank/BankDatabaseImplement/Implements/TransferStorage.cs b/Bank/BankDatabaseImplement/Implements/TransferStorage.cs index 219831d..86fc2ce 100644 --- a/Bank/BankDatabaseImplement/Implements/TransferStorage.cs +++ b/Bank/BankDatabaseImplement/Implements/TransferStorage.cs @@ -33,7 +33,7 @@ namespace BankDatabaseImplement.Implements .Include(x => x.Operation) .Where(x => (!model.Id.HasValue || x.Id == model.Id) && - ((x.SenderAccount != null && x.SenderAccount.ManagerId == model.ManagerId) || + (!model.ManagerId.HasValue || (x.SenderAccount != null && x.SenderAccount.ManagerId == model.ManagerId) || (x.RecipientAccount != null && x.RecipientAccount.ManagerId == model.ManagerId)) && (!model.SenderAccountId.HasValue || x.SenderAccountId == model.SenderAccountId) && (!model.RecipientAccountId.HasValue || x.RecipientAccountId == model.RecipientAccountId) &&