Исправление реализаций

This commit is contained in:
dasha 2023-03-10 18:35:12 +04:00
parent b63ef37d04
commit 7de3033c77
2 changed files with 4 additions and 4 deletions

View File

@ -21,14 +21,14 @@ namespace SushiBarFileImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{
if (!model.Id.HasValue)
if (!model.Id.HasValue && !model.DateFrom.HasValue)
{
return new();
}
if (model.DateFrom.HasValue)
{
return source.Orders
.Where(x => x.Id.Equals(model.Id) && x.DateCreate >= model.DateFrom)
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
.Select(x => GetViewModel(x))
.ToList();
}

View File

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