This commit is contained in:
gg12 darfren 2024-03-26 22:32:46 +04:00
parent 21fdf29cd6
commit e04cb36da6
2 changed files with 9 additions and 4 deletions

View File

@ -34,9 +34,14 @@ model)
return new(); return new();
} }
return source.Orders return source.Orders
.Where(x => x.Id == model.Id) .Where(x => (
.Select( x => AccessIceCreamStorage( x.GetViewModel)) (!model.Id.HasValue || x.Id == model.Id) &&
.ToList(); (!model.DateFrom.HasValue || x.DateCreate >= model.DateFrom) &&
(!model.DateTo.HasValue || x.DateCreate <= model.DateTo)
)
)
.Select(x => x.GetViewModel)
.ToList();
} }
public OrderViewModel? GetElement(OrderSearchModel model) public OrderViewModel? GetElement(OrderSearchModel model)

View File

@ -37,7 +37,7 @@ namespace IceCreamShopListImplement.Implements
} }
foreach (var order in _source.Orders) 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)); result.Add(AccessIceCreamStorage(order.GetViewModel));
} }