логикa получения списка фильтрованных заказов

This commit is contained in:
VictoriaPresnyakova 2023-03-20 21:21:36 +04:00
parent 3bae5d9c68
commit 06e21816a4

View File

@ -47,12 +47,14 @@ namespace JewelryStoreFileImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{
if (!model.Id.HasValue)
if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
{
return new();
return source.Orders
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
.Select(x => x.GetViewModel)
.ToList();
}
return source.Orders.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo).Select(x => Jewel(x.GetViewModel)).ToList();
return source.Orders.Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList();
}
public List<OrderViewModel> GetFullList()