Lisov N.A LabWork7 #7
@ -27,11 +27,24 @@ namespace DressAtelierFileImplement.Implements
|
|||||||
}
|
}
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.ID.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue)
|
if (!model.ID.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue && !model.ClientID.HasValue && !model.Status.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
return _source.Orders.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo).Select(x => ReceiveDressName(x)).ToList();
|
if (model.ClientID.HasValue)
|
||||||
|
{
|
||||||
|
return _source.Orders.Where(x => x.ClientID == model.ClientID).Select(x => ReceiveDressName(x)).ToList();
|
||||||
|
}
|
||||||
|
if (model.ID.HasValue)
|
||||||
|
{
|
||||||
|
return _source.Orders.Where(x => x.ID == model.ID).Select(x => ReceiveDressName(x)).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||||
|
{
|
||||||
|
return _source.Orders.Where(x => model.DateFrom >= x.DateCreate && model.DateTo <= x.DateCreate).Select(x => ReceiveDressName(x)).ToList();
|
||||||
|
}
|
||||||
|
return _source.Orders.Where(x => x.Status.Equals(model.Status)).ToList().Select(x => ReceiveDressName(x)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||||
|
@ -32,10 +32,37 @@ namespace DressAtelierListImplement.Implements
|
|||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
var result = new List<OrderViewModel>();
|
var result = new List<OrderViewModel>();
|
||||||
if (!model.ID.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue)
|
if (!model.ID.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue && !model.ClientID.HasValue && !model.Status.HasValue)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (model.ClientID.HasValue)
|
||||||
|
{
|
||||||
|
foreach (var order in _source.Orders)
|
||||||
|
{
|
||||||
|
if (order.ClientID == model.ClientID)
|
||||||
|
{
|
||||||
|
result.Add(ReceiveDressName(order.GetViewModel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.ID.HasValue)
|
||||||
|
{
|
||||||
|
foreach (var order in _source.Orders)
|
||||||
|
{
|
||||||
|
if (order.ID == model.ID)
|
||||||
|
{
|
||||||
|
result.Add(ReceiveDressName(order.GetViewModel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||||
|
{
|
||||||
foreach (var order in _source.Orders)
|
foreach (var order in _source.Orders)
|
||||||
{
|
{
|
||||||
if (order.DateCreate >= model.DateFrom && order.DateCreate <= model.DateTo)
|
if (order.DateCreate >= model.DateFrom && order.DateCreate <= model.DateTo)
|
||||||
@ -46,6 +73,17 @@ namespace DressAtelierListImplement.Implements
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var order in _source.Orders)
|
||||||
|
{
|
||||||
|
if (order.Status == model.Status)
|
||||||
|
{
|
||||||
|
result.Add(ReceiveDressName(order.GetViewModel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.ID.HasValue)
|
if (!model.ID.HasValue)
|
||||||
|
Loading…
Reference in New Issue
Block a user