4 лабу доделала в мае аче

This commit is contained in:
kamilia 2024-05-06 00:09:24 +04:00
parent c54abfcd3d
commit af429f0d16

View File

@ -49,11 +49,23 @@ namespace AircraftPlantListImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model) public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{ {
var result = new List<OrderViewModel>(); var result = new List<OrderViewModel>();
if (!model.Id.HasValue) if (!model.Id.HasValue || !model.DateFrom.HasValue || !model.DateTo.HasValue)
{ {
return result; 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) foreach (var order in _source.Orders)
{ {
if (order.Id == model.Id) if (order.Id == model.Id)