файлики не ссорьтесь больше пжпж

This commit is contained in:
kamilia 2024-05-06 00:14:13 +04:00
parent b41ff6cc25
commit 597153e01c
2 changed files with 23 additions and 1 deletions

View File

@ -49,11 +49,24 @@ namespace AircraftPlantListImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{
var result = new List<OrderViewModel>();
if (!model.Id.HasValue)
if (!model.Id.HasValue || !model.DateFrom.HasValue || !model.DateTo.HasValue)
{
return result;
}
if (model.DateFrom.HasValue)
{
foreach (var order in _source.Orders)
{
if (order.DateCreate >= model.DateFrom && order.DateCreate <= model.DateTo)
{
result.Add(GetViewModel(order));
}
}
return result;
}
foreach (var order in _source.Orders)
{
if (order.Id == model.Id)

View File

@ -28,6 +28,15 @@ namespace AircraftPlantFileImplement.Implements
{
return new();
}
if (model.DateFrom.HasValue)
{
return _source.Orders
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
.Select(x => GetViewModel(x))
.ToList();
}
return _source.Orders.Where(x => x.Id.Equals(model.Id)).Select(x => GetViewModel(x)).ToList();
}
public OrderViewModel? GetElement(OrderSearchModel model)