public ActionResult display() { var game_summary = _query_service.query_for_single <BlackJackTableView>( x => x.player_token == _player_authenticator.get_player_token()); var account_view = _query_service.query_for_single <AccountView>( x => x.player_token == _player_authenticator.get_player_token()); var game_play_view = new GamePlayView(); game_play_view.table = game_summary; game_play_view.account_information_view = new AccountInformationView() { player_is_logged_in = true, player_name = account_view.name }; if (game_summary == null) { return(RedirectToAction("Bet", "Bet")); } else { if (TempData.ContainsKey("Message")) { game_summary.game_message = TempData["Message"].ToString(); } return(View(game_play_view)); } }
public ActionResult CashIn() { var account_view = _query_service.query_for_single <AccountView>( x => x.player_token == _player_authenticator.get_player_token()); var account_information_view = new AccountInformationView(); account_information_view.player_is_logged_in = true; account_information_view.player_name = account_view.name; var cash_in_view = new CashInView() { account_information_view = account_information_view }; return(View(cash_in_view)); }
public ActionResult Insurance() { var hit_hand_command = new TakeInsuranceCommand(); hit_hand_command.player_id = _player_authenticator.get_player_token(); _command_bus.send(hit_hand_command); return(RedirectToAction("Display", "BlackJackTableGameView")); }
public ActionResult NewGame() { // TODO: Validate that the game has finished var clear_finished_game_command = new ClearFinishedGameCommand(); clear_finished_game_command.player_token = _player_authenticator.get_player_token(); _command_bus.send(clear_finished_game_command); return(RedirectToAction("Bet", "Bet")); }
public ActionResult Bet() { var bet_on_table = _query_service.query_for_single <BetOnBlackJackTableView>( x => x.player_token == _player_authenticator.get_player_token()); var account_view = _query_service.query_for_single <AccountView>( x => x.player_token == _player_authenticator.get_player_token()); if (bet_on_table == null) { var bet_on_game_form = new BetView(); bet_on_game_form.account_information_view = new AccountInformationView() { player_is_logged_in = true, player_name = account_view.name }; bet_on_game_form.bets_placed = new List <Domain.DomainViews.BettingView.BetView>(); bet_on_game_form.can_bet = true; bet_on_game_form.can_deal = false; bet_on_game_form.dollars_in_pot = account_view.dollars_in_pot; return(View(bet_on_game_form)); } else if (bet_on_table.display) { var bet_on_game_form = new BetView(); bet_on_game_form.account_information_view = new AccountInformationView() { player_is_logged_in = true, player_name = account_view.name }; bet_on_game_form.bets_placed = bet_on_table.bets_placed; bet_on_game_form.can_bet = bet_on_table.can_accept_bet; bet_on_game_form.can_deal = bet_on_table.can_deal; bet_on_game_form.dollars_in_pot = bet_on_table.dollars_in_pot; return(View(bet_on_game_form)); } else { return(RedirectToAction("Display", "BlackJackTableGameView")); } }
public ActionResult HitActiveHand() { var hit_hand_command = new HitHandCommand(); hit_hand_command.player_id = _player_authenticator.get_player_token(); DomainEvents.register_temp_event_handler <HandResultEvent>(e => this.FlashInfo(e.message)); _command_bus.send(hit_hand_command); return(RedirectToAction("Display", "BlackJackTableGameView")); }
public ActionResult Index() { var deal_command = new DealCommand() { player_token = _player_authenticator.get_player_token() }; DomainEvents.register_temp_event_handler <HandResultEvent>(e => this.FlashInfo(e.message)); _command_bus.send(deal_command); return(RedirectToAction("Display", "BlackJackTableGameView")); }
public ActionResult Index() { var stick_command = new StickHandCommand(); stick_command.player_id = _player_authenticator.get_player_token(); DomainEvents.register_temp_event_handler <HandResultEvent>(e => this.FlashInfo(e.message)); _command_bus.send(stick_command); // Redirect to the game view return(RedirectToAction("Display", "BlackJackTableGameView")); }
public ActionResult Split() { var split_hand_command = new SplitHandCommand(); split_hand_command.player_id = _player_authenticator.get_player_token(); try { _command_bus.send(split_hand_command); } catch (IllegalMoveException ex) { TempData["Message"] = ex.Message; } return(RedirectToAction("Display", "BlackJackTableGameView")); }
public ActionResult Index() { var account_view = _query_service.query_for_single <AccountView>( x => x.player_token == _player_authenticator.get_player_token()); var account_information_view = new AccountInformationView(); account_information_view.player_is_logged_in = true; account_information_view.player_name = account_view.name; var account_view_model = new AccountHomeView() { account_view = account_view, account_information_view = account_information_view }; return(View(account_view_model)); }
public ActionResult DoubleDown() { var split_hand_command = new DoubleDownCommand(); split_hand_command.player_id = _player_authenticator.get_player_token(); DomainEvents.register_temp_event_handler <HandResultEvent>(e => this.FlashInfo(e.message)); try { _command_bus.send(split_hand_command); } catch (IllegalMoveException ex) { TempData["Message"] = ex.Message; } return(RedirectToAction("Display", "BlackJackTableGameView")); }