public void AddPlayerRating( PlayerRating playerRating ) { playerRatings.Add( playerRating ); }
private void CreateRatingsFor( Game game ) { var players = database.GetPlayersForGame( game.Id ); foreach ( var ratingPlayer in players ) { foreach ( var ratedPlayer in players ) { var numberOfRatings = RatingsPerPlayer.Next(); for ( int i = 0; i < numberOfRatings; i++ ) { var rating = new PlayerRating(); rating.GameId = game.Id; rating.PlayerId = ratedPlayer.Id; rating.RatedByPlayerId = ratingPlayer.Id; rating.Timestamp = DateTime.Now - PlayerRatingHistoryLength.Next(); if ( .8.NextBool() ) { rating.Rating = RatingRange.Next(); } database.AddPlayerRating( rating ); } } } }
public void AddPlayerRating( PlayerRating playerRating ) { database .GetCollection<PlayerRating>( Collections.PlayerRatings ) .Insert( playerRating ); }