static void Main(string[] args) { ISongObservable songModel = new SongsModel(); ISongController songController = new MainController(songModel); IViewComponent mainView = new MainMenuView(songController); mainView.Display(); }
public virtual void InitWelcomeScreen() { TravelController.Init(); Console.WriteLine("\n\nWelcome to Travel Manager\n"); Console.WriteLine("\n\nKindly select the your user type\n"); Console.WriteLine("1 - Admin"); Console.WriteLine("2 - Guest User"); int selection = Utils.OptionSelection(2); TravelController.Init(); switch (selection) { case 1: Console.WriteLine("\n**** Authentication is required for Admin mode****"); AdminView.Display(); break; case 2: MainMenuView.Display(); break; } }
private void GoToMainMenu() { InitializeMainMenu(); scoreManager.ResetScore(); mainMenuView.Display(); }
static void Main(string[] args) { httpClient.BaseAddress = new Uri("https://localhost:5001/api/"); var scoreService = new ScoreService(httpClient); var gameService = new GameService(httpClient); var isRunning = true; while (isRunning) { MainMenuView.Display(); var selected = ReadKey(true); switch (selected.Key) { case D1: ListHighScoreView.Display(scoreService); var listHighScoreSelection = ReadKey(true); if (listHighScoreSelection.Key != E) { var scoreId = Convert.ToInt32(ReadLine()); var score = ListHighScoreView.DisplayById(scoreId, scoreService); var listByIdSelection = ReadKey(true); if (listByIdSelection.Key == R) { var task = scoreService.DeleteHighscoreAsync(score.Id); task.Wait(); } } break; case D2: var gameView = new ListGamesView(httpClient); gameView.ListGames(); var listGamesSelection = ReadKey(true); if (listGamesSelection.Key != E) { var gameId = Convert.ToInt32(ReadLine()); var game = gameView.ListGameById(gameId); var listByIdSelection = ReadKey(true); if (listByIdSelection.Key == R) { StandardMessages.DisplayAreYouSure(); var yesOrNo = ReadKey(true).Key; if (yesOrNo == Y) { var task = gameService.DeleteGameAsync(game.Id); task.Wait(); } } if (listByIdSelection.Key == U) { gameView.DisplayUpdateGame(); var newTitle = ReadLine(); var newDescription = ReadLine(); var task = gameService.PutGameAsync(game.Id, new Game { Description = newDescription, Title = newTitle, Id = game.Id }); task.Wait(); var newGameView = gameView.ListGameById(game.Id); ReadKey(true); } } break; case D3: isRunning = false; break; } } }