Модель

This commit is contained in:
dasha 2023-03-19 12:20:57 +04:00
parent 50c0cdc17e
commit f997e6fc06

View File

@ -41,14 +41,9 @@ namespace SushiBarFileImplement.Implements
private OrderViewModel GetViewModel(Order order) private OrderViewModel GetViewModel(Order order)
{ {
var viewModel = order.GetViewModel; var viewModel = order.GetViewModel;
foreach (var sushi in source.ListSushi) var sushi = source.ListSushi.FirstOrDefault(x => x.Id == order.SushiId);
{ if (sushi == null) return null;
if (sushi.Id == order.SushiId)
{
viewModel.SushiName = sushi.SushiName; viewModel.SushiName = sushi.SushiName;
break;
}
}
return viewModel; return viewModel;
} }
public OrderViewModel? Insert(OrderBindingModel model) public OrderViewModel? Insert(OrderBindingModel model)