Упрощение отображения названия изделия в заказе
This commit is contained in:
parent
43c216879b
commit
1d46ac3610
@ -14,18 +14,16 @@ namespace BlacksmithWorkshopFileImplement.Implements
|
||||
{
|
||||
source = DataFileSingleton.GetInstance();
|
||||
}
|
||||
private OrderViewModel AddManufactureName (OrderViewModel model)
|
||||
{
|
||||
model.ManufactureName = source.Manufactures.SingleOrDefault(x => x.Id == model.ManufactureId)?.ManufactureName ?? string.Empty;
|
||||
return model;
|
||||
}
|
||||
public List<OrderViewModel> GetFullList()
|
||||
{
|
||||
List<OrderViewModel> orderList = new();
|
||||
orderList = source.Orders
|
||||
.Select(x => x.GetViewModel)
|
||||
return source.Orders
|
||||
.Select(x => AddManufactureName(x.GetViewModel))
|
||||
.ToList();
|
||||
foreach (var order in orderList)
|
||||
{
|
||||
var manufactureName = source.Manufactures.SingleOrDefault(x => x.Id == order.ManufactureId)?.ManufactureName ?? string.Empty;
|
||||
order.ManufactureName = manufactureName;
|
||||
}
|
||||
return orderList;
|
||||
}
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
@ -33,17 +31,10 @@ namespace BlacksmithWorkshopFileImplement.Implements
|
||||
{
|
||||
return new();
|
||||
}
|
||||
List<OrderViewModel> orderList = new();
|
||||
orderList = source.Orders
|
||||
return source.Orders
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.Select(x => AddManufactureName(x.GetViewModel))
|
||||
.ToList();
|
||||
foreach (var order in orderList)
|
||||
{
|
||||
var manufactureName = source.Manufactures.SingleOrDefault(x => x.Id == order.ManufactureId)?.ManufactureName ?? string.Empty;
|
||||
order.ManufactureName = manufactureName;
|
||||
}
|
||||
return orderList;
|
||||
}
|
||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user