Exemple #1
0
        public async Task <int> GetInsureCoins(GetInsureCoinsGameView getInsureCoinsGameView)
        {
            Player player = await _playerRepository.Get(getInsureCoinsGameView.PlayerId);

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

            if (player == null || hand == null)
            {
                var stringBuilder = new StringBuilder();

                stringBuilder.AppendLine(string.Format("RoundId: {0}", getInsureCoinsGameView.RoundId));
                stringBuilder.AppendLine(string.Format("PlayerId: {0}", getInsureCoinsGameView.PlayerId));
                stringBuilder.AppendLine(string.Format("Message: {0}", SolutionConstants.BUSINESS_LOGIC_GET_ITEM_EXCEPTION_MESSAGE));

                string message = stringBuilder.ToString();

                throw new BusinessLogicGetItemException(message);
            }

            int insurance = hand.Deal / GameConstants.INSURE_DEVISION;

            return(insurance);
        }
Exemple #2
0
        public async Task <int> GetInsureCoins([FromBody] GetInsureCoinsGameView getInsureCoinsGameView)
        {
            int coins = await _gameLogicService.GetInsureCoins(getInsureCoinsGameView);

            return(coins);
        }