public static List <Recipe> GetMealsRecipes(List <Meal> listOfMeals) { var database = new SQLiteDataService(); database.Initialize(); var recipesByMealsList = listOfMeals.SelectMany(meal => database.GetRecipesByMeal(meal.Id)).ToList(); database.Close(); return(recipesByMealsList); }
public static List <RecipeViewModel> GetMealRecipes(int mealId) { var database = new SQLiteDataService(); database.Initialize(); var recipeByMealList = database.GetRecipesByMeal(mealId).Select(recipe => new RecipeViewModel(recipe)).ToList(); database.Close(); return(recipeByMealList); }