Add Methodf to get all Shoopinglists on endpoint of the Detail Site of Shoppinglist

This commit is contained in:
Francesco Lorenzo D'Amico
2025-05-20 16:05:03 +02:00
parent 69affbdaed
commit b1a0a41202
@@ -60,10 +60,15 @@
return NotFound(); return NotFound();
} }
var recipeInAnyShoppingList = (await _shoppingListRepository.GetAllShoppingListsAsync())
.SelectMany(sl => sl.RecipeShoppingList.Select(rsl => rsl.Recipe))
.ToList();
var viewModel = new ShoppingListDetailsViewModel var viewModel = new ShoppingListDetailsViewModel
{ {
ShoppingList = shoppingList, ShoppingList = shoppingList,
RecipeCount = recipeCount, RecipeCount = recipeCount,
RecipesInAnyShoppingList = recipeInAnyShoppingList,
}; };
return View(viewModel); return View(viewModel);