From 24f1159217b968735d5a72055638b54d91b76ffe Mon Sep 17 00:00:00 2001 From: Whoisthatjulia Date: Sun, 28 Apr 2024 21:30:55 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BF=D0=BE=D0=BA=D0=BE=D0=B9=D0=BD?= =?UTF-8?q?=D0=BE=D0=B9=20=D0=BD=D0=BE=D1=87=D0=B8,=20=D0=BC=D0=B0=D0=BB?= =?UTF-8?q?=D1=8B=D1=88=D0=B8))?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BankBusinessLogics.csproj | 9 +++++++++ Bank/BankContracts/BankContracts.csproj | 11 +++++++++++ .../ViewModels/PurchaseViewModel.cs | 6 +++--- .../BankDatabaseImplement.csproj | 18 ++++++++++++++++++ .../Implements/OperationStorage.cs | 8 ++++---- .../Implements/PurchaseStorage.cs | 6 +++--- 6 files changed, 48 insertions(+), 10 deletions(-) diff --git a/Bank/BankBusinessLogics/BankBusinessLogics.csproj b/Bank/BankBusinessLogics/BankBusinessLogics.csproj index 132c02c..1a65821 100644 --- a/Bank/BankBusinessLogics/BankBusinessLogics.csproj +++ b/Bank/BankBusinessLogics/BankBusinessLogics.csproj @@ -6,4 +6,13 @@ enable + + + + + + + + + diff --git a/Bank/BankContracts/BankContracts.csproj b/Bank/BankContracts/BankContracts.csproj index 132c02c..3a3e2fa 100644 --- a/Bank/BankContracts/BankContracts.csproj +++ b/Bank/BankContracts/BankContracts.csproj @@ -6,4 +6,15 @@ enable + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + diff --git a/Bank/BankContracts/ViewModels/PurchaseViewModel.cs b/Bank/BankContracts/ViewModels/PurchaseViewModel.cs index 6d972f8..39308ed 100644 --- a/Bank/BankContracts/ViewModels/PurchaseViewModel.cs +++ b/Bank/BankContracts/ViewModels/PurchaseViewModel.cs @@ -25,12 +25,12 @@ namespace BankContracts.ViewModels $"Сделка, созданная {DatePurchase}, включает в себя операции:"); for (int i = 0; i < OperationViewModels.Count; i++) { - var car = OperationViewModels[i]; - if (car == null) + var operation = OperationViewModels[i]; + if (operation == null) { break; } - result.Append($"\n\t{i + 1}. {car.Mark} {car.Model} стоимостью {car.Price}"); + result.Append($"\n\t{i + 1}. {operation.Mark} {operation.Model} стоимостью {operation.Price}"); } return result.ToString(); } diff --git a/Bank/BankDatabaseImplement/BankDatabaseImplement.csproj b/Bank/BankDatabaseImplement/BankDatabaseImplement.csproj index 132c02c..909dc93 100644 --- a/Bank/BankDatabaseImplement/BankDatabaseImplement.csproj +++ b/Bank/BankDatabaseImplement/BankDatabaseImplement.csproj @@ -6,4 +6,22 @@ enable + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + diff --git a/Bank/BankDatabaseImplement/Implements/OperationStorage.cs b/Bank/BankDatabaseImplement/Implements/OperationStorage.cs index 7925cc9..aefd31b 100644 --- a/Bank/BankDatabaseImplement/Implements/OperationStorage.cs +++ b/Bank/BankDatabaseImplement/Implements/OperationStorage.cs @@ -98,14 +98,14 @@ namespace BankDatabaseImplement.Implements public OperationViewModel? Update(OperationBindingModel model) { using var context = new BankDB(); - var car = context.Operations.FirstOrDefault(x => x.Id == model.Id); - if (car == null) + var operation = context.Operations.FirstOrDefault(x => x.Id == model.Id); + if (operation == null) { return null; } - car.Update(model); + operation.Update(model); context.SaveChanges(); - return car.GetViewModel; + return operation.GetViewModel; } } } diff --git a/Bank/BankDatabaseImplement/Implements/PurchaseStorage.cs b/Bank/BankDatabaseImplement/Implements/PurchaseStorage.cs index 78b1e34..c4354e1 100644 --- a/Bank/BankDatabaseImplement/Implements/PurchaseStorage.cs +++ b/Bank/BankDatabaseImplement/Implements/PurchaseStorage.cs @@ -44,15 +44,15 @@ namespace BankDatabaseImplement.Implements throw new ArgumentNullException(nameof(modelOperation), "Получена поисковая модель без Id"); } using var context = new BankDB(); - var carByPurchase = context.OperationByPurchases + var operationByPurchase = context.OperationByPurchases .Include(x => x.Payments) .FirstOrDefault(x => x.OperationId == modelOperation.Id && x.PurchaseId == modelPurchase.Id); - if (carByPurchase?.Payments == null) + if (operationByPurchase?.Payments == null) { throw new InvalidOperationException( $"Не существует связи между данной операции(Id={modelOperation.Id}) и покупкой(Id={modelPurchase.Id})"); } - return carByPurchase.Payments.Select(payment => payment.GetViewModel).ToList(); + return operationByPurchase.Payments.Select(payment => payment.GetViewModel).ToList(); } public PurchaseViewModel? GetElement(PurchaseSearchModel model)