public IActionResult getById(int tableId)
        {
            var table = _playTableService.GetTableById(tableId);
            var model = _mapper.Map <PlayTableModel>(table);

            return(Ok(model));
        }
예제 #2
0
        public static PlayTableStaeModel GetTableState(int tableId, IPlayTableService playTableService, IMapper mapper)
        {
            var table = playTableService.GetTableById(tableId);

            if (table != null)
            {
                var tablePlayers = playTableService.GetPlayersOfTable(tableId);
                var tableState   = mapper.Map <PlayTableStaeModel>(table);
                tableState.UserCount     = tablePlayers.Length;
                tableState.TableId       = table.Id;
                tableState.Players       = tablePlayers.Select((p) => new AdditionPlayerInfoModel(p)).ToArray();
                tableState.ShuffleCount  = tablePlayers.Count(p => p.ShuffleRound);
                tableState.NextTurnCount = tablePlayers.Count(p => p.NextTurn);
                return(tableState);
            }
            return(null);
        }