fix
This commit is contained in:
parent
da162462b5
commit
5dbea38023
@ -24,10 +24,8 @@ namespace FoodOrdersBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
public List<DishViewModel>? ReadList(DishSearchModel? model)
|
public List<DishViewModel>? ReadList(DishSearchModel? model)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("ReadList. DishName:{DishName}. Id:{Id}",
|
_logger.LogInformation("ReadList. DishName:{DishName}. Id:{Id}", model?.DishName, model?.Id);
|
||||||
model?.DishName, model?.Id);
|
var list = model == null ? _dishStorage.GetFullList() : _dishStorage.GetFilteredList(model);
|
||||||
var list = model == null ? _dishStorage.GetFullList() :
|
|
||||||
_dishStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
if (list == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("ReadList return null list");
|
_logger.LogWarning("ReadList return null list");
|
||||||
|
@ -22,8 +22,7 @@ namespace FoodOrdersListImplement.Implements
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public List<DishViewModel> GetFilteredList(DishSearchModel
|
public List<DishViewModel> GetFilteredList(DishSearchModel model)
|
||||||
model)
|
|
||||||
{
|
{
|
||||||
var result = new List<DishViewModel>();
|
var result = new List<DishViewModel>();
|
||||||
if (string.IsNullOrEmpty(model.DishName))
|
if (string.IsNullOrEmpty(model.DishName))
|
||||||
@ -47,9 +46,7 @@ namespace FoodOrdersListImplement.Implements
|
|||||||
}
|
}
|
||||||
foreach (var dish in _source.Dish)
|
foreach (var dish in _source.Dish)
|
||||||
{
|
{
|
||||||
if ((!string.IsNullOrEmpty(model.DishName) &&
|
if ((!string.IsNullOrEmpty(model.DishName) && dish.DishName == model.DishName) || (model.Id.HasValue && dish.Id == model.Id))
|
||||||
dish.DishName == model.DishName) ||
|
|
||||||
(model.Id.HasValue && dish.Id == model.Id))
|
|
||||||
{
|
{
|
||||||
return dish.GetViewModel;
|
return dish.GetViewModel;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user