コード例 #1
0
        public void ViewMenu(string viewMenu)
        {
            var tracker = new PlantTracker();

            while (viewMenu != "all" && viewMenu != "locations" && viewMenu != "water" && viewMenu != "need")
            {
                Console.WriteLine("Invalid input. Please input (ALL), (LOCATIONS), (WATER) or (NEED)");
                viewMenu = Console.ReadLine().ToLower();
            }
            //displays all the plants by locations
            if (viewMenu == "all")
            {
                tracker.ViewAll();
            }
            else if (viewMenu == "water")
            {
                tracker.NotWatered();
            }
            else if (viewMenu == "locations")
            {
                Console.WriteLine("What location do you want to check?");
                var plantLocation = Console.ReadLine().ToLower();
                tracker.Locations(plantLocation);
            }
            else if (viewMenu == "need")
            {
                tracker.NeedWater();
            }
        }
コード例 #2
0
        public void WaterPlantInput()
        {
            var tracker = new PlantTracker();

            tracker.ViewAll();
            Console.WriteLine("What plant do you want to water? Please select by Id number");
            var plantId = int.Parse(Console.ReadLine());

            tracker.WaterPlant(plantId);
        }