fix
This commit is contained in:
parent
a0c3ce3431
commit
c46e798a61
@ -122,6 +122,10 @@ namespace FoodOrdersBusinessLogic.BusinessLogics
|
||||
_logger.LogWarning("Change status operation failed");
|
||||
return false;
|
||||
}
|
||||
if (viewModel.ImplementerId.HasValue)
|
||||
{
|
||||
model.ImplementerId = viewModel.ImplementerId;
|
||||
}
|
||||
model.Status = newStatus;
|
||||
if (model.Status == OrderStatus.Готов)
|
||||
{
|
||||
|
@ -37,17 +37,17 @@ namespace FoodOrdersDatabaseImplement.Implements
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else if (model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
if (model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
{
|
||||
return context.Orders
|
||||
.Include(x => x.Dish)
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Implementer)
|
||||
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
.Include(x => x.Dish)
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Implementer)
|
||||
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else if (model.Status != null)
|
||||
if (model.Status != null)
|
||||
{
|
||||
return context.Orders
|
||||
.Include(x => x.Dish)
|
||||
@ -55,7 +55,7 @@ namespace FoodOrdersDatabaseImplement.Implements
|
||||
.Include(x => x.Implementer)
|
||||
.Where(x => model.Status == x.Status)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList(); ;
|
||||
.ToList();
|
||||
}
|
||||
return context.Orders
|
||||
.Include(x => x.Dish)
|
||||
|
@ -21,6 +21,10 @@ namespace FoodOrdersFileImplement.Implements
|
||||
}
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.ClientId.HasValue && !model.Status.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
if (model.ClientId.HasValue)
|
||||
{
|
||||
return _source.Orders
|
||||
@ -28,14 +32,24 @@ namespace FoodOrdersFileImplement.Implements
|
||||
.Select(x => GetViewModel(x))
|
||||
.ToList();
|
||||
}
|
||||
if (!model.Id.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
if (model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
{
|
||||
return _source.Orders
|
||||
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
|
||||
.Select(x => GetViewModel(x))
|
||||
.ToList();
|
||||
}
|
||||
return _source.Orders.Where(x => x.Id == model.Id).Select(x => GetViewModel(x)).ToList();
|
||||
if (model.Status != null)
|
||||
{
|
||||
return _source.Orders
|
||||
.Where(x => model.Status == x.Status)
|
||||
.Select(x => GetViewModel(x))
|
||||
.ToList();
|
||||
}
|
||||
return _source.Orders
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => GetViewModel(x))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||
|
@ -30,6 +30,10 @@ namespace FoodOrdersListImplement.Implements
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
var result = new List<OrderViewModel>();
|
||||
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.ClientId.HasValue && !model.Status.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
if (model.ClientId.HasValue)
|
||||
{
|
||||
foreach (var order in _source.Orders)
|
||||
@ -41,7 +45,7 @@ namespace FoodOrdersListImplement.Implements
|
||||
}
|
||||
return result;
|
||||
}
|
||||
if (!model.Id.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
if (model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
{
|
||||
foreach (var order in _source.Orders)
|
||||
{
|
||||
@ -52,6 +56,17 @@ namespace FoodOrdersListImplement.Implements
|
||||
}
|
||||
return result;
|
||||
}
|
||||
if (model.Status != null)
|
||||
{
|
||||
foreach (var order in _source.Orders)
|
||||
{
|
||||
if (model.Status == order.Status)
|
||||
{
|
||||
result.Add(GetViewModel(order));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
foreach (var order in _source.Orders)
|
||||
{
|
||||
if (order.Id == model.Id)
|
||||
|
Loading…
Reference in New Issue
Block a user