private static void DeleteTaskListByName()//Delete tasklist using name { Console.Write("Delete some taskList ? (%Title%): "); string answer14 = Console.ReadLine(); if (!answer14.Equals("")) { ToDoTaskList list = MainControl.FindList(answer14, currentUser); if (list != null) // If list exist { MainControl.Delete(list); Console.WriteLine("List with name \"" + answer14 + "\" has been succesfully deleted"); currentUser = UserLab.Get().GetUser(currentUser.Id); // Refresh current user if (currentList != null) { if (answer14 == currentList.Title) // If deleted list with current name has been deleted, refresh current list { currentList = null; } } } else { Console.WriteLine("List with name: \"" + answer14 + "\" not found"); } } }
private static int DeleteAccount(int currentLevel) { Console.Write("Do you want to delete? (Yes/~): "); string answer = Console.ReadLine(); if (answer.Equals("Yes")) { MainControl.Delete(currentUser); currentLevel = 0; } return(currentLevel); }
private static void DeleteTaskInCurrentListByName()//Delete task in current taskList using name { Console.Write("Delete task in current taskList ? (skip if don`t) (%Title%): "); string answer15 = Console.ReadLine(); if (!answer15.Equals("")) { ToDoTask taskForDelete = MainControl.FindTask(answer15, currentList); if (taskForDelete != null) { MainControl.Delete(taskForDelete); Console.WriteLine("Task with name \"" + answer15 + "\" has been succesfully deleted"); currentUser = UserLab.Get().GetUser(currentUser.Id); // Refresh current user currentList = MainControl.FindList(currentList.Title, UserLab.Get().GetUser(currentUser.Id)); currentTask = MainControl.FindTask(answer15, currentList); } else { Console.WriteLine("Task with name: \"" + answer15 + "\" not found"); } } }