Merging 06 to 07.

This commit is contained in:
Yuee Shiness 2023-05-02 21:17:55 +04:00
commit 67b9f9ecec
2 changed files with 55 additions and 4 deletions

View File

@ -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)

View File

@ -32,18 +32,56 @@ 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)
{
if (order.DateCreate >= model.DateFrom && order.DateCreate <= model.DateTo)
{
result.Add(ReceiveDressName(order.GetViewModel));
}
}
return result;
}
foreach (var order in _source.Orders) foreach (var order in _source.Orders)
{ {
if (order.DateCreate >= model.DateFrom && order.DateCreate <= model.DateTo) if (order.Status == model.Status)
{ {
result.Add(ReceiveDressName(order.GetViewModel)); result.Add(ReceiveDressName(order.GetViewModel));
} }
} }
return result; return result;
} }
public OrderViewModel? GetElement(OrderSearchModel model) public OrderViewModel? GetElement(OrderSearchModel model)