From 3f62f0b923232492c5f251c464ee78286878169a Mon Sep 17 00:00:00 2001 From: ujijrujijr Date: Wed, 1 May 2024 20:54:46 +0400 Subject: [PATCH] =?UTF-8?q?=D0=91=D1=8B=D1=81=D1=82=D1=80=D0=B0=D1=8F=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ComputerShopContracts/ViewModels/ReportOrdersViewModel.cs | 7 ++----- ComputerShopDatabaseImplement/Implements/OrderStorage.cs | 6 ++++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ComputerShopContracts/ViewModels/ReportOrdersViewModel.cs b/ComputerShopContracts/ViewModels/ReportOrdersViewModel.cs index baa5bb2..162060a 100644 --- a/ComputerShopContracts/ViewModels/ReportOrdersViewModel.cs +++ b/ComputerShopContracts/ViewModels/ReportOrdersViewModel.cs @@ -14,10 +14,7 @@ namespace ComputerShopContracts.ViewModels public double OrderSum { get; set; } public OrderStatus OrderStatus { get; set; } - //данные заявок - public List<(int RequestId, string ClientFIO, DateTime DateRequest)> Requests { get; set; } - - //данные сборок - public List<(string AssemblyName, string AssemblyCategory, double AssemblyPrice)> Assemblies { get; set; } + //данные заявок и сборок + public List<(int RequestId, string ClientFIO, DateTime DateRequest, string AssemblyName, string AssemblyCategory, double AssemblyPrice)> RequestsAssemblies { get; set; } } } diff --git a/ComputerShopDatabaseImplement/Implements/OrderStorage.cs b/ComputerShopDatabaseImplement/Implements/OrderStorage.cs index 1797e41..9ea174b 100644 --- a/ComputerShopDatabaseImplement/Implements/OrderStorage.cs +++ b/ComputerShopDatabaseImplement/Implements/OrderStorage.cs @@ -90,8 +90,10 @@ namespace ComputerShopDatabaseImplement.Implements DateCreateOrder = x.DateCreate, OrderSum = x.Sum, OrderStatus = x.Status, - Requests = x.Requests.Select(r => (r.Request.Id, r.Request.ClientFIO, r.Request.DateRequest)).ToList(), - Assemblies = x.Requests.Select(r => (r.Request.Assembly.AssemblyName, r.Request.Assembly.Category, r.Request.Assembly.Price)).ToList(), + RequestsAssemblies = x.Requests.Select(r => (r.Request.Id, r.Request.ClientFIO, r.Request.DateRequest, + (r.Request.Assembly != null) ? r.Request.Assembly.AssemblyName : "Без сборки", + (r.Request.Assembly != null) ? r.Request.Assembly.Category : "Без сборки", + (r.Request.Assembly != null) ? r.Request.Assembly.Price : 0)).ToList() }) .ToList(); }