Balberova D.N. LabWork04Hard #8

Closed
august wants to merge 11 commits from LabWork04Hard into LabWork03Hard
2 changed files with 4 additions and 4 deletions
Showing only changes of commit 7de3033c77 - Show all commits

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