示例#1
0
        public async Task SetDealPlayer(SetDealPlayerGameView setDealPlayerGameView)
        {
            Player player = await _playerRepository.Get(setDealPlayerGameView.PlayerId);

            Round round = await _roundRepository.Get(setDealPlayerGameView.RoundId);

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

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

                string message = stringBuilder.ToString();

                throw new BusinessLogicGetItemException(message);
            }

            var hand = new Hand();

            hand.Summary   = GameConstants.DEFAULT_SUMMARY_AT_START;
            hand.Situation = Situation.None;
            hand.Deal      = setDealPlayerGameView.Coins;
            hand.PlayerId  = player.Id;
            hand.RoundId   = round.Id;

            await _handRepository.Create(hand);
        }
示例#2
0
 public async Task SetDealPlayer([FromBody] SetDealPlayerGameView setDealPlayerGameView)
 {
     await _gameLogicService.SetDealPlayer(setDealPlayerGameView);
 }