diff --git a/AircraftPlant/AircraftPlantListImplement/Implements/OrderStorage.cs b/AircraftPlant/AircraftPlantListImplement/Implements/OrderStorage.cs index f24a094..cdd1b93 100644 --- a/AircraftPlant/AircraftPlantListImplement/Implements/OrderStorage.cs +++ b/AircraftPlant/AircraftPlantListImplement/Implements/OrderStorage.cs @@ -38,7 +38,7 @@ namespace AircraftPlantListImplement.Implements var result = new List(); foreach (var order in _source.Orders) { - result.Add(order.GetViewModel); + result.Add(GetViewModel(order)); } return result; } @@ -60,7 +60,7 @@ namespace AircraftPlantListImplement.Implements { if (order.Id == model.Id) { - result.Add(order.GetViewModel); + result.Add(GetViewModel(order)); } } return result; @@ -82,7 +82,7 @@ namespace AircraftPlantListImplement.Implements { if (model.Id.HasValue && order.Id == model.Id) { - return order.GetViewModel; + return GetViewModel(order); } } return null; @@ -111,7 +111,7 @@ namespace AircraftPlantListImplement.Implements } _source.Orders.Add(newOrder); - return newOrder.GetViewModel; + return GetViewModel(newOrder); } /// @@ -126,7 +126,7 @@ namespace AircraftPlantListImplement.Implements if (order.Id == model.Id) { order.Update(model); - return order.GetViewModel; + return GetViewModel(order); } } return null; @@ -145,10 +145,29 @@ namespace AircraftPlantListImplement.Implements { var element = _source.Orders[i]; _source.Orders.RemoveAt(i); - return element.GetViewModel; + return GetViewModel(element); } } return null; } + + /// + /// Получение модели заказа + /// + /// + /// + private OrderViewModel GetViewModel(Order order) + { + var viewModel = order.GetViewModel; + foreach (var sushi in _source.Planes) + { + if (sushi.Id == order.PlaneId) + { + viewModel.PlaneName = sushi.PlaneName; + break; + } + } + return viewModel; + } } }