diff --git a/SoftwareInstallation/SoftwareInstallationFileImplement/Implements/OrderStorage.cs b/SoftwareInstallation/SoftwareInstallationFileImplement/Implements/OrderStorage.cs index b555ea6..5512397 100644 --- a/SoftwareInstallation/SoftwareInstallationFileImplement/Implements/OrderStorage.cs +++ b/SoftwareInstallation/SoftwareInstallationFileImplement/Implements/OrderStorage.cs @@ -92,12 +92,9 @@ namespace SoftwareInstallationFileImplement.Implements } private OrderViewModel GetPackageName(OrderViewModel viewModel) { - foreach (var package in source.Packages) - { - if (package.Id == viewModel.PackageId) - { - viewModel.PackageName = package.PackageName; - } + var package = source.Packages.FirstOrDefault(x => x.Id == viewModel.PackageId); + if (package != null) { + viewModel.PackageName = package.PackageName; } return viewModel; }