order + client (list)

This commit is contained in:
VictoriaPresnyakova 2023-04-01 20:54:27 +04:00
parent 6716b74d72
commit dc2492a0e1
2 changed files with 28 additions and 9 deletions

View File

@ -51,15 +51,34 @@ namespace JewelryStoreListImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{
var result = new List<OrderViewModel>();
if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
if (model.DateFrom.HasValue)
{
return result;
}
foreach (var order in _source.Orders)
{
if (order.DateCreate >= model.DateFrom && order.DateCreate <= model.DateTo)
foreach (var order in _source.Orders)
{
result.Add(order.GetViewModel);
if (order.DateCreate >= model.DateFrom && order.DateCreate <= model.DateTo)
{
result.Add(order.GetViewModel);
}
}
}
else if (model.ClientId.HasValue && !model.Id.HasValue)
{
foreach (var order in _source.Orders)
{
if (order.ClientId == model.ClientId)
{
result.Add(order.GetViewModel);
}
}
}
else if (model.Id.HasValue)
{
foreach (var order in _source.Orders)
{
if (order.Id == model.Id)
{
result.Add(order.GetViewModel);
}
}
}
return result;

View File

@ -15,8 +15,6 @@ namespace JewelryStoreListImplement.Models
public int JewelId { get; private set; }
public string JewelName { get; private set; }
public int ClientId { get; private set; }
public int Count { get; private set; }
public double Sum { get; private set; }
@ -38,6 +36,7 @@ namespace JewelryStoreListImplement.Models
{
Id = model.Id,
JewelId = model.JewelId,
ClientId = model.ClientId,
JewelName = model.JewelName,
Count = model.Count,
Sum = model.Sum,
@ -64,6 +63,7 @@ namespace JewelryStoreListImplement.Models
{
Id = Id,
JewelId = JewelId,
ClientId = ClientId,
JewelName = JewelName,
Count = Count,
Sum = Sum,