Изменение получения отфильтрованного списка заказа
This commit is contained in:
parent
00fd7a1f50
commit
5342ad9663
@ -35,14 +35,14 @@ namespace AutomobilePlantListImplement.Implements
|
||||
{
|
||||
var result = new List<OrderViewModel>();
|
||||
|
||||
if (!model.Id.HasValue)
|
||||
if (model is null)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
foreach (var order in _source.Orders)
|
||||
{
|
||||
if (model.Id.HasValue && order.Id == model.Id)
|
||||
if (order.DateCreate > model.DateFrom && order.DateCreate < model.DateTo)
|
||||
{
|
||||
result.Add(order.GetViewModel);
|
||||
}
|
||||
|
@ -24,13 +24,13 @@ namespace AutomobilePlantDataBaseImplements.Implements
|
||||
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
if (model.Id.HasValue)
|
||||
if (model is null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new AutoPlantDataBase();
|
||||
return context.Orders
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
|
@ -45,12 +45,12 @@ namespace AutomomilePlantFileImplement.Implements
|
||||
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
if (model is null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
return source.Orders
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Where(x => x.DateCreate > model.DateFrom && x.DateCreate < model.DateTo)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user