как-будто конец
This commit is contained in:
parent
3539346f95
commit
d7bba696c7
@ -25,18 +25,18 @@ namespace ComputersShopDatabaseImplements.Implements
|
|||||||
}
|
}
|
||||||
public List<OrderViewModel> GetFiltredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFiltredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
|
if (!model.DateFrom.HasValue && !model.ClientId.HasValue && !model.Id.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
using var context = new ComputersShopDatabase();
|
using var context = new ComputersShopDatabase();
|
||||||
if (model.DateFrom.HasValue)
|
if (model.DateFrom.HasValue)
|
||||||
{
|
{
|
||||||
return context.Orders.Include(x => x.Computer).Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo).Select(x => x.GetViewModel).ToList();
|
return context.Orders.Include(x => x.Computer).Include(x => x.Client).Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo).Select(x => x.GetViewModel).ToList();
|
||||||
}
|
}
|
||||||
if (model.ClientId.HasValue)
|
if (model.ClientId.HasValue)
|
||||||
{
|
{
|
||||||
return context.Orders.Include(x => x.Computer).Where(x => x.ClientId == model.ClientId).Select(x => x.GetViewModel).ToList();
|
return context.Orders.Include(x => x.Computer).Include(x => x.Client).Where(x => x.ClientId == model.ClientId).Select(x => x.GetViewModel).ToList();
|
||||||
}
|
}
|
||||||
return context.Orders.Where(x => x.Id == model.Id).Include(x => x.Computer).Include(x => x.Client)
|
return context.Orders.Where(x => x.Id == model.Id).Include(x => x.Computer).Include(x => x.Client)
|
||||||
.Select(x => x.GetViewModel).ToList();
|
.Select(x => x.GetViewModel).ToList();
|
||||||
|
Loading…
Reference in New Issue
Block a user