доделки составления фильтрованного списка заказов в других реализациях

This commit is contained in:
Мк Игорь 2023-03-26 20:39:28 +04:00
parent 50fcb82aa9
commit 18908c82ee
2 changed files with 4 additions and 4 deletions

View File

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

View File

@ -28,13 +28,13 @@ namespace BlacksmithWorkshopListImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{
var result = new List<OrderViewModel>();
if (model.Id == null)
if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
{
return result;
}
foreach (var order in _source.Orders)
{
if (model.Id.HasValue && order.Id == model.Id)
if (model.Id.HasValue && order.DateCreate >= model.DateFrom && order.DateCreate <= model.DateTo)
{
OrderViewModel vm = order.GetViewModel;
var manufacture = _source.Manufactures.Find(x => x.Id == order.ManufactureId);