/// <summary> /// GetHitLocations() - returns all hit locations /// </summary> /// <returns> List of HitLocation</returns> public List <HitLocation> GetHitLocations() { List <HitLocation> hitLocationList = (from h in _repo.Query <HitLocation>() select h).ToList(); return(hitLocationList); }
private GlobalGameStatsView LoadGlobalStats() { GlobalGameStatsView globalStats = (from g in _repo.Query <GlobalStats>() orderby g.Id descending select new GlobalGameStatsView { Id = g.Id, PlayerWithMostWins = g.PlayerWithMostWins, PlayerWithMostGamesId = g.PlayerWithMostGamesId, MostWins = g.MostWins, PlayerWithMostGames = g.PlayerWithMostGames, PlayerWithMostWinsId = g.PlayerWithMostWinsId, MostGamesPlayed = g.MostGamesPlayed, PlayerWithBestWinRatio = g.PlayerWithBestWinRatio, PlayerWithBestWinRatioId = g.PlayerWithBestWinRatioId, BestWinRatio = g.BestWinRatio, PlayerWithGreatestAvgPointSpreadWins = g.PlayerWithGreatestAvgPointSpreadWins, PlayerWithGreatestAvgPointSpreadWinsId = g.PlayerWithGreatestAvgPointSpreadWinsId, BestAvgPointSpreadWins = g.BestAvgPointSpreadWins, PlayerWithLeastAvgPointSpreadLosses = g.PlayerWithLeastAvgPointSpreadLosses, PlayerWithLeastAvgPointSpreadLossesId = g.PlayerWithLeastAvgPointSpreadLossesId, LeastAvgPointSpreadLosses = g.LeastAvgPointSpreadLosses, GameWithLongestVolleyHits = g.GameWithLongestVolleyHits, Player1GameWithLongestVolleyHits = g.Player1GameWithLongestVolleyHits, Player1GameWithLongestVolleyHitsId = g.Player1GameWithLongestVolleyHitsId, Player2GameWithLongestVolleyHits = g.Player2GameWithLongestVolleyHits, Player2GameWithLongestVolleyHitsId = g.Player2GameWithLongestVolleyHitsId, LongestVolleyHits = g.LongestVolleyHits, GameWithLongestVolleyTime = g.GameWithLongestVolleyTime, Player1GameWithLongestVolleyTime = g.Player1GameWithLongestVolleyTime, Player1GameWithLongestVolleyTimeId = g.Player1GameWithLongestVolleyTimeId, Player2GameWithLongestVolleyTime = g.Player2GameWithLongestVolleyTime, Player2GameWithLongestVolleyTimeId = g.Player2GameWithLongestVolleyTimeId, LongestVolleyTime = g.LongestVolleyTime, LastUpdated = g.LastUpdated }).FirstOrDefault(); return(globalStats); }
/// <summary> /// GetGames() - returns all games /// </summary> /// <returns>List of GamesView</returns> public List <GamesView> GetGames() { int playerId; Player player; //List<HitLocation> gameHitLocations; List <GamesView> gameList = (from g in _repo.Query <Game>() orderby g.CreatedDate descending select new GamesView { Id = g.Id, Player1Id = g.Player1.Id, Player1Score = g.Player1Score, Player2Id = g.Player2.Id, Player2Score = g.Player2Score, MaxVelocity = g.MaxVelocity, LongestVolleyHits = g.LongestVolleyHits, LongestVolleyTime = g.LongestVolleyTime, CreatedDate = g.CreatedDate }).ToList(); foreach (GamesView game in gameList) { playerId = game.Player1Id; player = (from p in _repo.Query <Player>() where p.Id == playerId select p).FirstOrDefault(); game.Player1 = player; playerId = game.Player2Id; player = (from p in _repo.Query <Player>() where p.Id == playerId select p).FirstOrDefault(); game.Player2 = player; //gameHitLocations = (from h in _repo.Query<HitLocation>() // where h.Game.Id == game.Id // select h).ToList(); //game.GameHitLocations = gameHitLocations; } return(gameList); }
public List <Player> ListPlayers() { List <Player> playerList = (from p in _repo.Query <Player>() select p).ToList(); return(playerList); }