ПИбд-23 Салин Олег Алексеевич Лабораторная работа №4 (Усложненная) #18
@ -34,9 +34,14 @@ model)
|
||||
return new();
|
||||
}
|
||||
return source.Orders
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select( x => AccessIceCreamStorage( x.GetViewModel))
|
||||
.ToList();
|
||||
.Where(x => (
|
||||
(!model.Id.HasValue || x.Id == model.Id) &&
|
||||
(!model.DateFrom.HasValue || x.DateCreate >= model.DateFrom) &&
|
||||
(!model.DateTo.HasValue || x.DateCreate <= model.DateTo)
|
||||
)
|
||||
)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||
|
@ -37,7 +37,7 @@ namespace IceCreamShopListImplement.Implements
|
||||
}
|
||||
foreach (var order in _source.Orders)
|
||||
{
|
||||
if (order.Id == model.Id)
|
||||
if ((model.Id.HasValue && order.Id == model.Id) || (model.DateFrom.HasValue && model.DateTo.HasValue && (order.DateCreate >= model.DateFrom && order.DateCreate <= model.DateTo)))
|
||||
{
|
||||
result.Add(AccessIceCreamStorage(order.GetViewModel));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user