public void StartMenu() { OrderService orderService = new OrderService(); int num = -1; while (true) { try { Console.ForegroundColor = ConsoleColor.Yellow; Console.Write( "----------\nPlease enter a number." + "\n 1 to add; 2 to delete;" + "\n 3 to modify;4 to show all;" + "\n 5 to search; 6 to Sort;" + "\n 7 to export; 8 to import" + "\nother num to quit:"); num = int.Parse(Console.ReadLine()); switch (num) { case 1: orderService.AddOrder(); break; case 2: orderService.DeleteOrderByOrderNum(); break; case 3: orderService.ModifyOrderByOrderNum(); break; case 4: orderService.ShowAllOrders(); break; case 5: orderService.SearchBySomeWay(); break; case 6: orderService.SortBySomeWay(); break; case 7: orderService.Export(); break; case 8: orderService.Import(); break; default: return; } } catch (Exception e) { Console.ForegroundColor = ConsoleColor.DarkRed; Console.Write("Error:" + e + '\n'); continue; } } }