示例#1
0
        private void AddIngredientToMeal()
        {
            GetCafeContents();

            Console.WriteLine("\nEnter ID of meal you would like to add ingredient to:");
            string      identAsInt = Console.ReadLine();
            int         devID      = Convert.ToInt32(identAsInt);
            CafeContent pulledID   = _cafeRepo.GetMenuByID(devID);

            bool moreIngredients = true;

            while (moreIngredients == true)
            {
                GetIngredients();

                Console.WriteLine("What ingredient do you want to add to this meal:");
                string             ingred       = Console.ReadLine().Trim().ToLower();
                IngredientsContent pulledIngred = _iRepo.GetIngredientByName(ingred);

                pulledID.ListOfIngredients.Add(pulledIngred);

                Console.WriteLine("\nWould you like to add another ingredient?(yes/no)");
                string addAnother = Console.ReadLine().Trim().ToLower();
                if (addAnother == "yes")
                {
                    moreIngredients = true;
                }
                else
                {
                    moreIngredients = false;
                }
            }
        }