예제 #1
0
        private static bool GetMainMenuUserInput(TodoCollection todoCollection)
        {
            bool exit = false;

            string choice = Console.ReadLine();

            if (string.IsNullOrEmpty(choice))
            {
                exit = true;
            }
            else if (todoCollection.IdExists(choice))
            {
                RunSelection(todoCollection, choice);
            }
            else if (!todoCollection.Exists(choice))
            {
                todoCollection.Add(new Todo()
                {
                    Description = choice, PriorityLevel = GetPriorityForNewEntry(), Color = ConsoleColor.White
                });
                todoCollection.Save();
            }
            else if (choice == "mmm")
            {
                MMM();
            }

            return(exit);
        }
예제 #2
0
        private static string GetNewDescription(Todo todoSelection, TodoCollection todoCollection)
        {
            Print.NewLine("\nWrite a new description for this todo. Just enter without typing anything will exit.");
            string newDescription = Console.ReadLine();

            if (!string.IsNullOrEmpty(newDescription) && todoCollection.Exists(newDescription))
            {
                Print.NewLine("The entry already exists. Try again.", ConsoleColor.Red);
                return(GetNewDescription(todoSelection, todoCollection));
            }
            return(newDescription);
        }