コード例 #1
0
        // Toggle a task as 'done' or 'in-progress' in the database.
        private void ToggleTask(DatabaseTools dbTools)
        {
            // User writes which task they want to toggle.
            Console.WriteLine("Enter name of task to be toggled:");
            string name = Console.ReadLine();

            // Check if the task exists
            if (!dbTools.TaskExists(name))
            {
                Console.WriteLine(string.Format("Error: Task named '{0}' doesn't exist.", name));
                return;
            }

            // Call the database tools to make changes to the database.
            dbTools.ToggleTask(name);
        }