ПИбд-23 Салин Олег Алексеевич Лабораторная работа №4 (Усложненная) #18

Closed
Oleja123 wants to merge 30 commits from Lab4_Hard into Lab4
2 changed files with 9 additions and 4 deletions
Showing only changes of commit e04cb36da6 - Show all commits

View File

@ -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)

View File

@ -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));
}