public void AddPlayer( Game game, string userId ) { if ( !game.Players.Contains( userId ) ) { game.Players.Add( userId ); this.repository.Save<Game>( game ); } }
public Game CreateGameWithScenario( User creator, string scenario, string name ) { var game = new Game( name, creator.Id ); game.Scenario = scenario; this.AddPlayer( game, creator.Id ); return game; }
public void RemovePlayer( Game game, string userId ) { if ( game.Players.Contains( userId ) ) { game.Players.Remove( userId ); } this.repository.Save<Game>( game ); }
public void AddGame( Game game ) { this.repository.Save<Game>( game ); this.games.TryAdd( game.Id, game ); }