ISEbd-21 Melnikov I. O. Lab Work 04 Advanced #28

Closed
Igor-Melnikov wants to merge 19 commits from lab4adv into lab3adv
2 changed files with 4 additions and 4 deletions
Showing only changes of commit 18908c82ee - Show all commits

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);