예제 #1
0
        /*        internal static string updateIngredientQuery(RecipeToIngredient recipeToIngredient)
         *      {
         *          return $"update ingredients set IngredientName values ('{recipeToIngredient.IngredientName}')";
         *      }*/

        internal static string updateRecipeComponent(FullRecipe fullRecipe, RecipeToIngredient recipeToIngredient)
        {
            return($"update recipeComponents (" +
                   $" set RecipeId = (select recipeid from recipes where recipes.recipename='{fullRecipe.recipe.RecipeName}'), " +
                   $" set IngredientId = (select ingredientId from Ingredients where ingredients.ingredientName='{recipeToIngredient.IngredientName}'), " +
                   $" set Quantity = {recipeToIngredient.Quantity}" +
                   $" set Unit = '{recipeToIngredient.Unit}') ) " +
                   $" where recipes.recipeId = {fullRecipe.recipe.RecipeId};");
        }
예제 #2
0
 public static string insertRecipeComponent(FullRecipe fullRecipe, RecipeToIngredient recipeToIngredient) => $"insert into recipeComponents(" +
 $"RecipeId, " +
 $"IngredientId, " +
 $"Quantity, " +
 $"Unit) " +
 $"values" +
 $"((select recipeid from recipes where recipes.recipename='{fullRecipe.recipe.RecipeName}')," +
 $"(select ingredientId from Ingredients where ingredients.ingredientName='{recipeToIngredient.IngredientName}'), " +
 $"{recipeToIngredient.Quantity}, " +
 $"'{recipeToIngredient.Unit}')";
예제 #3
0
 public static string insertIngredientQuery(RecipeToIngredient recipeToIngredient) =>
 $"insert into ingredients(IngredientName) values ('{recipeToIngredient.IngredientName}')";