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