From 26558beae3b5b5fba724fa77a277e37ad9a86ccd Mon Sep 17 00:00:00 2001 From: Artyom_Yashin Date: Thu, 2 May 2024 15:48:52 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A7=D1=82=D0=BE=20=D1=82=D0=BE=20=D1=82?= =?UTF-8?q?=D0=B8=D0=BF=D0=BE=20=D0=B2=D1=8B=D0=B1=D0=BE=D1=80=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bank/BankClientApp/Views/Home/OperationUpdate.cshtml | 4 ++-- Bank/BankContracts/SearchModels/OperationSearchModel.cs | 1 + Bank/BankContracts/SearchModels/RequestSearchModel.cs | 1 + Bank/BankContracts/SearchModels/TransferSearchModel.cs | 1 + Bank/BankDatabaseImplement/Implements/OperationStorage.cs | 3 ++- Bank/BankDatabaseImplement/Implements/RequestStorage.cs | 3 ++- Bank/BankDatabaseImplement/Implements/TransferStorage.cs | 3 ++- 7 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Bank/BankClientApp/Views/Home/OperationUpdate.cshtml b/Bank/BankClientApp/Views/Home/OperationUpdate.cshtml index efdee9d..b8278fb 100644 --- a/Bank/BankClientApp/Views/Home/OperationUpdate.cshtml +++ b/Bank/BankClientApp/Views/Home/OperationUpdate.cshtml @@ -1,9 +1,9 @@  @{ - ViewData["Title"] = "OperationDelete"; + ViewData["Title"] = "OperationUpdate"; }
-

Удаление операции

+

Обновление операции

diff --git a/Bank/BankContracts/SearchModels/OperationSearchModel.cs b/Bank/BankContracts/SearchModels/OperationSearchModel.cs index 8aecfa4..8f45f47 100644 --- a/Bank/BankContracts/SearchModels/OperationSearchModel.cs +++ b/Bank/BankContracts/SearchModels/OperationSearchModel.cs @@ -13,5 +13,6 @@ namespace BankContracts.SearchModels public DateTime? DateTo { get; set; } public int? SenderCardId { get; set; } public int? RecipientCardId { get; set; } + public int? CardId { get; set; } } } diff --git a/Bank/BankContracts/SearchModels/RequestSearchModel.cs b/Bank/BankContracts/SearchModels/RequestSearchModel.cs index 2270880..16ec198 100644 --- a/Bank/BankContracts/SearchModels/RequestSearchModel.cs +++ b/Bank/BankContracts/SearchModels/RequestSearchModel.cs @@ -14,5 +14,6 @@ namespace BankContracts.SearchModels public DateTime? DateTo { get; set; } public string? CardNumber { get; set; } public RequestStatus? Status { get; set; } + public int? CardId { get; set; } } } diff --git a/Bank/BankContracts/SearchModels/TransferSearchModel.cs b/Bank/BankContracts/SearchModels/TransferSearchModel.cs index 5816e4a..31c6e8f 100644 --- a/Bank/BankContracts/SearchModels/TransferSearchModel.cs +++ b/Bank/BankContracts/SearchModels/TransferSearchModel.cs @@ -14,5 +14,6 @@ namespace BankContracts.SearchModels public int? OperationId { get; set; } public int? SenderAccountId { get; set; } public int? RecipientAccountId { get; set; } + public int? CardId { get; set; } } } diff --git a/Bank/BankDatabaseImplement/Implements/OperationStorage.cs b/Bank/BankDatabaseImplement/Implements/OperationStorage.cs index 9273b47..39a9186 100644 --- a/Bank/BankDatabaseImplement/Implements/OperationStorage.cs +++ b/Bank/BankDatabaseImplement/Implements/OperationStorage.cs @@ -27,7 +27,8 @@ namespace BankDatabaseImplement.Implements .Where(x => ( (!model.Id.HasValue || x.Id == model.Id) && (!model.DateFrom.HasValue || x.OperationTime >= model.DateFrom ) && - (!model.DateTo.HasValue || x.OperationTime <= model.DateTo) + (!model.DateTo.HasValue || x.OperationTime <= model.DateTo) && + (!model.CardId.HasValue || x.RecipientCardId == model.CardId || x.SenderCardId == model.CardId) )).Select(x => x.GetViewModel).ToList(); } public OperationViewModel? GetElement(OperationSearchModel model) diff --git a/Bank/BankDatabaseImplement/Implements/RequestStorage.cs b/Bank/BankDatabaseImplement/Implements/RequestStorage.cs index e03abf0..a729b39 100644 --- a/Bank/BankDatabaseImplement/Implements/RequestStorage.cs +++ b/Bank/BankDatabaseImplement/Implements/RequestStorage.cs @@ -31,7 +31,8 @@ namespace BankDatabaseImplement.Implements return context.Requests.Include(x => x.Cards).ThenInclude(x => x.Card) .Where(x => (model.Id.HasValue && x.Id == model.Id) && (!model.DateFrom.HasValue || x.RequestTime >= model.DateFrom) && - (!model.DateTo.HasValue || x.RequestTime <= model.DateTo) + (!model.DateTo.HasValue || x.RequestTime <= model.DateTo) && + (!model.CardId.HasValue || x.Cards.Select(x => x.CardId).ToList().Contains(model.CardId.Value)) ).ToList() .Select(x => x.GetViewModel).ToList(); } diff --git a/Bank/BankDatabaseImplement/Implements/TransferStorage.cs b/Bank/BankDatabaseImplement/Implements/TransferStorage.cs index 5e3e8bb..f4fcd33 100644 --- a/Bank/BankDatabaseImplement/Implements/TransferStorage.cs +++ b/Bank/BankDatabaseImplement/Implements/TransferStorage.cs @@ -37,7 +37,8 @@ namespace BankDatabaseImplement.Implements (!model.RecipientAccountId.HasValue || x.RecipientAccountId == model.RecipientAccountId) && (!model.OperationId.HasValue || x.OperationId == model.OperationId) && (!model.DateFrom.HasValue || x.TransferTime >= model.DateFrom) && - (!model.DateTo.HasValue || x.TransferTime <= model.DateTo) + (!model.DateTo.HasValue || x.TransferTime <= model.DateTo) && + (!model.CardId.HasValue || x.Operation.RecipientCardId == model.CardId || x.Operation.SenderCardId == model.CardId) ).Select(x => x.GetViewModel).ToList(); }