public Welcome() { RestaurantScreen = new RestaurantScreen(() => { Selection = -1; ProcessSelection(); }); Selection = default; RatingSystemScreen = new RatingSystemScreen(() => { Selection = -1; ProcessSelection(); }); }
/// <summary> /// Process user selection /// </summary> private void ProcessSelection() { switch (Selection) { case -1: Console.Clear(); // go back to main menu Header(); break; case 1: Console.Clear(); RestaurantScreen.ToJSON(); break; case 2: Console.Clear(); Console.Write("Please enter your name: "); var name = Console.ReadLine(); RatingSystemScreen.MainMenu(name); break; case 3: RestaurantScreen.MainMenu(); break; case 4: throw new NotImplementedException("Stay tuned for further updates"); case 5: Console.Clear(); Environment.Exit(Environment.ExitCode); break; default: Console.WriteLine("Invalid selection, press any key..."); Console.ReadLine(); Console.Clear(); // go back to main menu Header(); break; ; } }