public GameInstance(Game game) { this.Game = game; this.GameId = GameId; this.PlayedFrom = DateTime.Now; this.TotalTimePlayed = new TimeSpan(); }
public static void CheckStatisticsForGame(Statistic statistic, Game game) { if (statistic.GamesPlayed.FirstOrDefault(g => g.GameName == game.GameName) != null) { StatisticMethods.AddGameToStatistics(statistic, game); } }
public static bool CheckIfGameIsCurrent(Game game, Channel channel) { bool gameIsCurrent = channel.DailyActivities .FirstOrDefault(d => d.ActivityDate == DateTime.Now) .GameInstances.Any(gi => gi.Game == game); return gameIsCurrent; }
public static void AddGameToStatistics(Statistic statistic, Game game) { var moonDb = new MoonAidAzureContext(); statistic.GamesPlayed.Add(game); moonDb.Entry(statistic).State = EntityState.Modified; }
public static Game CreateNewGame(string twitchGameName) { var moonDb = new MoonAidAzureContext(); var game = new Game { GameName = twitchGameName }; moonDb.Games.Add(game); moonDb.SaveChanges(); return game; }