dop logic
This commit is contained in:
parent
f396af1eb9
commit
7630dabb9e
@ -39,7 +39,11 @@ namespace PizzeriaListImplement.Implements
|
|||||||
|
|
||||||
foreach (var order in _source.Orders)
|
foreach (var order in _source.Orders)
|
||||||
{
|
{
|
||||||
if (model.Id.HasValue && order.Id == model.Id)
|
if (
|
||||||
|
(!model.Id.HasValue || order.Id == model.Id) &&
|
||||||
|
(!model.DateFrom.HasValue || order.DateCreate >= model.DateFrom) &&
|
||||||
|
(!model.DateTo.HasValue || order.DateCreate <= model.DateTo)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
OrderViewModel viewModel = order.GetViewModel;
|
OrderViewModel viewModel = order.GetViewModel;
|
||||||
viewModel.PizzaName = _pizzaStorage.GetElement(new PizzaSearchModel { Id = order.PizzaId }).PizzaName;
|
viewModel.PizzaName = _pizzaStorage.GetElement(new PizzaSearchModel { Id = order.PizzaId }).PizzaName;
|
||||||
|
@ -23,7 +23,10 @@ namespace PizzeriaFileImplement.Implements
|
|||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
return source.Orders
|
return source.Orders
|
||||||
.Where(x => (model.Id.HasValue && x.Id == model.Id))
|
.Where(x =>
|
||||||
|
(!model.Id.HasValue || x.Id == model.Id) &&
|
||||||
|
(!model.DateFrom.HasValue || x.DateCreate >= model.DateFrom) &&
|
||||||
|
(!model.DateTo.HasValue || x.DateCreate <= model.DateTo))
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user