public static GameDto ToDto(this Game game) { var gameDto = new GameDto { id = game.Id.ToString(), blackPlayer = game.BlackPlayer.ToDto(), whitePlayer = game.WhitePlayer.ToDto(), currentPlayer = (PlayerColor)game.CurrentPlayer, playState = (GameState)game.PlayState, points = game.Points.Select(p => p.ToDto()).ToArray(), validMoves = game.ValidMoves.Select(m => m.ToDto()).ToArray(), thinkTime = Game.ClientCountDown - (DateTime.Now - game.ThinkStart).TotalSeconds }; return(gameDto); }
public static GameDto ToDto(this Game game) { var gameDto = new GameDto { id = game.Id.ToString(), blackPlayer = game.BlackPlayer.ToDto(), whitePlayer = game.WhitePlayer.ToDto(), currentPlayer = (PlayerColor)game.CurrentPlayer, playState = (GameState)game.PlayState, points = game.Points.Select(p => p.ToDto()).ToArray(), validMoves = game.ValidMoves.Select(m => m.ToDto()).ToArray(), thinkTime = Game.ClientCountDown - (DateTime.Now - game.ThinkStart).TotalSeconds, goldMultiplier = game.GoldMultiplier, isGoldGame = game.IsGoldGame, lastDoubler = game.LastDoubler.HasValue ? (PlayerColor)game.LastDoubler : null, stake = game.Stake }; return(gameDto); }