Пример #1
0
        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");
            }            
        }
Пример #2
0
        public ActionResult Bet(BetView bet_view)
        {                        
            var bet_command = _bet_command_mapper.map_from(bet_view, _player_authenticator.get_player_token());

            try
            {
                _command_bus.send(bet_command);
            }
            catch (NotEnoughFundsException ex)
            {                
                this.FlashWarning(ex.Message);
            }            

            return RedirectToAction("Bet");
        }
        public ActionResult Bet(BetView bet_view)
        {
            var bet_command = _bet_command_mapper.map_from(bet_view, _player_authenticator.get_player_token());

            try
            {
                _command_bus.send(bet_command);
            }
            catch (NotEnoughFundsException ex)
            {
                this.FlashWarning(ex.Message);
            }

            return(RedirectToAction("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"));
            }
        }