public static void Run() { Console.WriteLine("1. List all student"); Console.WriteLine("2. Register new student"); Console.WriteLine("3. Update existing student"); Console.WriteLine("4. Deleting existing student"); Console.WriteLine("5. Quit"); int choice = ConsoleUtil.CaptureInputInt("Enter your choice", 1, 5); switch (choice) { case 1: ListAllStudents(); break; case 2: RegisterNewStudent(); break; case 3: UpdateExistingStudent(); break; case 4: RemoveStudent(); break; case 5: Console.WriteLine("Thank you!"); return; } Run(); }
private static int CaptureOption() { StringBuilder menu = new StringBuilder(); menu.AppendLine("Select Your Option:"); menu.AppendLine("1. Create current account"); menu.AppendLine("2. List all account"); menu.AppendLine("3. Deposit"); menu.AppendLine("4. WithDraw"); menu.AppendLine("5. Find Account"); return(ConsoleUtil.CaptureInputInt(menu.ToString(), 1, 5)); }
private static void RemoveStudent() { int stId = ConsoleUtil.CaptureInputInt("Enter student id to be removed", 0, Int32.MaxValue); Deleting(stId); }