parent
979d739d7c
commit
5e719844c3
@ -15,9 +15,7 @@ namespace SushiBarFileImplement.Implements
|
|||||||
}
|
}
|
||||||
public List<OrderViewModel> GetFullList()
|
public List<OrderViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
return source.Orders
|
return source.Orders.Select(x => AttachSushiName(x.GetViewModel)).ToList();
|
||||||
.Select(x => AttachSushiName(x.GetViewModel))
|
|
||||||
.ToList();
|
|
||||||
}
|
}
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
@ -25,13 +23,9 @@ namespace SushiBarFileImplement.Implements
|
|||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
return source.Orders
|
return source.Orders.Where(x =>
|
||||||
.Where(o =>
|
x.Id == model.Id).Select(x =>
|
||||||
(model.Id.HasValue && o.Id == model.Id) ||
|
AttachSushiName(x.GetViewModel)).ToList();
|
||||||
(model.DateFrom.HasValue && model.DateTo.HasValue &&
|
|
||||||
model.DateFrom < o.DateCreate && o.DateCreate < model.DateTo))
|
|
||||||
.Select(x => AttachSushiName(x.GetViewModel))
|
|
||||||
.ToList();
|
|
||||||
}
|
}
|
||||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
@ -39,8 +33,8 @@ namespace SushiBarFileImplement.Implements
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return AttachSushiName(source.Orders
|
return AttachSushiName(source.Orders.FirstOrDefault(x =>
|
||||||
.FirstOrDefault(x => (x.Id == model.Id))?.GetViewModel);
|
(x.Id == model.Id))?.GetViewModel);
|
||||||
}
|
}
|
||||||
public OrderViewModel? Insert(OrderBindingModel model)
|
public OrderViewModel? Insert(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
|
@ -25,11 +25,13 @@ namespace SushiBarListImplement.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 == null || !model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
foreach (var order in _source.Orders)
|
foreach (var order in _source.Orders)
|
||||||
{
|
{
|
||||||
if (order.Id == model.Id ||
|
if (order.Id == model.Id)
|
||||||
(model.DateFrom.HasValue && model.DateTo.HasValue &&
|
|
||||||
model.DateFrom < order.DateCreate && order.DateCreate < model.DateTo)))
|
|
||||||
{
|
{
|
||||||
result.Add(AttachSushiName(order.GetViewModel));
|
result.Add(AttachSushiName(order.GetViewModel));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user