OrderCheck

This commit is contained in:
Sergey Kozyrev 2024-02-20 19:33:08 +04:00
parent 58ffae6460
commit eb19e42237

View File

@ -19,29 +19,29 @@ namespace SewingDressesListImplement.Implements
var result = new List<OrderViewModel>();
foreach (var order in _source.Orders)
{
result.Add(order.GetViewModel);
result.Add(AcessDressesStorage(order.GetViewModel));
}
return result;
}
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{
var result = new List<OrderViewModel>();
foreach (var order in _source.Orders)
{
if (order.Id == model.Id)
{
result.Add(order.GetViewModel);
result.Add(AcessDressesStorage(order.GetViewModel));
}
}
return result;
}
public OrderViewModel? GetElement(OrderSearchModel model)
{
{
if (!model.Id.HasValue)
{
return null;
}
}
foreach (var order in _source.Orders)
{
if (model.Id.HasValue && order.Id == model.Id)
@ -62,7 +62,7 @@ namespace SewingDressesListImplement.Implements
}
}
var newOrder = Order.Create(model);
if (newOrder == null)
if (newOrder == null)
{
return null;
}
@ -94,5 +94,17 @@ namespace SewingDressesListImplement.Implements
}
return null;
}
public OrderViewModel AcessDressesStorage(OrderViewModel model)
{
foreach (var dress in _source.Dresses)
{
if (dress.Id == model.DressId)
{
model.DressName = dress.DressName;
break;
}
}
return model;
}
}
}