Example #1
0
        public async Task <bool> CheckAbilityToInsure(CheckAbilityToInsureGameView checkAbilityToInsureGameView)
        {
            Player player = await _playerRepository.Get(checkAbilityToInsureGameView.PlayerId);

            Hand hand = await _handRepository.GetHandByRoundAndPlayerId(checkAbilityToInsureGameView.RoundId, checkAbilityToInsureGameView.PlayerId);

            if (player == null || hand == null)
            {
                return(false);
            }

            var result = false;

            int insurance = hand.Deal / GameConstants.INSURE_DEVISION;

            if ((player.Coins - hand.Deal - insurance) >= 0 && insurance != 0)
            {
                result = true;
            }

            return(result);
        }
Example #2
0
        public async Task <bool> CheckAbilityToInsure([FromBody] CheckAbilityToInsureGameView checkAbilityToInsureGameView)
        {
            bool response = await _gameLogicService.CheckAbilityToInsure(checkAbilityToInsureGameView);

            return(response);
        }