конец

This commit is contained in:
Катя Ихонкина 2023-04-04 20:39:51 +04:00
parent 09dd8c0577
commit 5c366274cd
2 changed files with 20 additions and 4 deletions

View File

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

View File

@ -56,7 +56,7 @@ namespace PrecastConcretePlantListImplement.Implements
{
var result = new List<OrderViewModel>();
if (!model.Id.HasValue)
if (!model.Id.HasValue && (model.DateFrom == null || model.DateTo == null))
{
return result;
}
@ -68,6 +68,16 @@ namespace PrecastConcretePlantListImplement.Implements
result.Add(order.GetViewModel);
}
}
if (!model.Id.HasValue)
{
foreach(var order in _source.Orders)
{
if (order.DateCreate >= model.DateFrom && order.DateCreate <= model.DateTo)
{
result.Add(order.GetViewModel);
}
}
}
return result;
}