public void RecipeMenu(Operator operations, string connectionString, int userID) { //this speeds up the process by bipassing the database interaction if its already local // as a team we need to figure how to do this on a much bigger scale to minimize interactions that happen //in real time so that users feel like the app is fast if (Recipes.Any <Recipe>() == false) { Recipes = operations.allRecipes(connectionString); } // if (userInput == "1" || userInput == "recipe") { List <Recipe> myRecipes = operations.allRecipes(connectionString); foreach (Recipe temprecipe in myRecipes) { temprecipe.printRecipe(); } } Console.WriteLine("\nRecipe Menu! Options: \n "); // Console.Write("All Recipes (recipe or 1)" + "\n"); Console.Write("See ingredients from a recipe '2' " + "\n"); Console.Write("See instructions from a recipe '3' " + "\n"); Console.WriteLine("Print Recipe by ID '4' "); Console.WriteLine("Delete Recipe '5'"); Console.WriteLine("Update Recipe '6'"); Console.WriteLine("Reorder Recipe '7'"); Console.Write("'menu' for main menu" + "\n"); Console.WriteLine(); // Console.Write("all Ingredients in a receipe" + "\n"); string userInput = Console.ReadLine(); userInput = userInput.ToLower(); // operations.allIngredientInRecipe(connectionString); bool acted = false; if (userInput == "2") { operations.allIngredientInRecipe(connectionString); } if (userInput == "3") { operations.allInstructionInRecipe(connectionString); string wait = Console.ReadLine(); } if (userInput == "4") { Recipe myRecipe = operations.RecipeByID(connectionString, userID); myRecipe.printRecipe(); RecipeGuide myGuide = new RecipeGuide(UserID); myGuide.previewRecipe(myRecipe); string wait = Console.ReadLine(); } if (userInput == "5") { operations.allRecipes(connectionString); Console.WriteLine("Select Recipe By ID"); Recipe Rec = operations.RecipeByID(connectionString, userID); if (Rec.getInstructionRecipe().Any <Instruction>()) { operations.DeleteRecipeWithInstruction(connectionString, userID, Rec); } else { operations.DeleteRecipeWithoutInstruction(connectionString, userID, Rec); } string wait = Console.ReadLine(); } if (userInput == "6") { Recipe myrecipe = operations.RecipeByID(connectionString, userID); RecipeGuide guide = new RecipeGuide(userID); string wait = Console.ReadLine(); } if (userInput == "menu") { acted = true; } if (acted == false) { RecipeMenu(operations, connectionString, userID); } }
public void CreateMenu(Operator operations, string connectionString) { Console.WriteLine("Created Ingredients"); foreach (Ingredient blah in createdIngredients) { blah.printIngredient(); } Console.WriteLine("Created Instructions"); foreach (Instruction meh in createdInstruction) { meh.printInstructionToConsole(); } Console.WriteLine("All who venture here be warnded"); Console.WriteLine("This is the create/insert menu! Please pick from these options"); Console.WriteLine("Create new: \n"); Console.WriteLine("Recipe '1'"); Console.WriteLine("Ingredient '2'"); Console.WriteLine("Show All Created ingredients/instructions '4'"); Console.WriteLine("Insert Created Ingredient '5'"); Console.WriteLine("Insert Created Instruction '6'"); Console.WriteLine("Main Menu 'menu'"); string userInput = Console.ReadLine(); bool acted = false; if (userInput == "1") { RecipeGuide myGuide = new RecipeGuide("Test Recipe", UserID); Recipe myrecipe = myGuide.startUpRecipeGuide(connectionString, UserID); myGuide.previewRecipe(myrecipe); } if (userInput == "2") { Ingredient myingredient = new Ingredient(); createdIngredients.Add(myingredient); } if (userInput == "4") { Console.WriteLine("Created ingredients:"); foreach (Ingredient temp in createdIngredients) { temp.printIngredient(); } Console.WriteLine("Created instructions:"); foreach (Instruction temp in createdInstruction) { temp.instructionRelavant(); } } if (userInput == "5") { Console.WriteLine("Created ingredients:"); foreach (Ingredient temp in createdIngredients) { temp.printIngredient(); } Console.WriteLine("Select Created Ingredient By Name"); string ingname = Console.ReadLine(); foreach (Ingredient temp in createdIngredients) { if (temp.getName() == ingname) { operations.insertIngredient(connectionString, temp, UserID); } } } if (userInput == "6") { Console.WriteLine("Created instructions:"); foreach (Instruction temp in createdInstruction) { temp.printInstructionToConsole(); } Console.WriteLine("Select Created Instruction By Name"); string insname = Console.ReadLine(); foreach (Instruction temp in createdInstruction) { if (temp.getTitle() == insname) { operations.insertInstruction(connectionString, temp, UserID); } } } if (userInput == "menu") { acted = true; } if (acted == false) { CreateMenu(operations, connectionString); } }