Example #1
0
        public static void CreateNewRecipe(List <IngredientByRecipe> ingredientByRecipeList, Recipe newRecipe)
        {
            recipeId++;
            var database = new SQLiteDataService();

            database.Initialize();
            newRecipe.Id = recipeId;
            database.AddRecipe(newRecipe);
            ingredientByRecipeList.ForEach(ibr =>
            {
                ibr.RecipeId = newRecipe.Id;
                database.AddIngredientByRecipe(ibr);
            });
            database.Close();
            AllUsersRecipes.Add(new RecipeViewModel(newRecipe));
        }