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(); }