GetViewModel with LINQ
This commit is contained in:
parent
4ac60f090d
commit
3aef079512
@ -82,14 +82,11 @@ namespace ComputersShopFileImplement.Implements
|
|||||||
private OrderViewModel GetViewModel(Order order)
|
private OrderViewModel GetViewModel(Order order)
|
||||||
{
|
{
|
||||||
var viewModel = order.GetViewModel;
|
var viewModel = order.GetViewModel;
|
||||||
foreach (var comp in source.Computers)
|
var comp = source.Computers.FirstOrDefault(comp => comp.Id == order.ComputerId);
|
||||||
{
|
if (comp != null)
|
||||||
if (comp.Id == order.ComputerId)
|
|
||||||
{
|
{
|
||||||
viewModel.ComputerName = comp.ComputerName;
|
viewModel.ComputerName = comp.ComputerName;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return viewModel;
|
return viewModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user