Пример #1
0
        public async Task <GetCardStartView> AddOneCard(string userId, string gameId)
        {
            if (
                (userId == null && gameId == null) ||
                (userId != null && gameId == null) ||
                (userId == null && gameId != null))
            {
                throw new BadRequestException();
            }

            var    player = new List <Player>();
            Player user   = await _playerRepository.Get(userId);

            player.Add(user);

            int move = _cardMoveRepository.CountMove(gameId, user.UserName);

            if (move == 0)
            {
                throw new NotFoundException();
            }
            Card card = await AddCard(move, gameId, player);

            GetCardStartView response = CreateCardView(card);

            return(response);
        }
Пример #2
0
        // AddCardView

        public GetCardStartView StartOneCardMapper(Card card)
        {
            var response = new GetCardStartView
            {
                Ranks = card.Rank.ToString(),
                Suit  = card.Suit.ToString(),
                Value = card.Value
            };

            return(response);
        }