public ActionResult Index() { IEnumerable <PvP> pvpStats = pvPTable.GetAll(); IEnumerable <Player> players = playerTable.GetAll(); IEnumerable <Game> games = gameTable.GetAll(); try { var pvpScoreboard = from s in pvpStats join p in players on s.pID equals p.ID join g in games on s.gID equals g.ID select new PvPViewModel { WinnerName = p.Name, OpponentName = s.OpponentName, GameName = g.Name, lastPlayedDate = s.LastMatch }; ViewBag.Title = "PvP"; return(View(pvpScoreboard)); } catch { return(View("Home")); } }
public ActionResult Highscores(int gID = -1) { IEnumerable <HighScore> highScores = new List <HighScore>(); IEnumerable <Player> players = new List <Player>(); IEnumerable <Game> games = new List <Game>(); List <object> idata = new List <object>(); highScores = gID > -1 ? hsTable.GetAll().Where(h => h.gID == gID) : hsTable.GetAll(); players = pTable.GetAll(); games = gID > -1 ? gTable.GetAll().Where(h => h.ID == gID) : gTable.GetAll(); IEnumerable <ChartViewModel> scoreBoard = (from h in highScores join p in players on h.pID equals p.ID join g in games on h.gID equals g.ID select new ChartViewModel { Name = p.Name, Highscore = h.Highscore, GameType = g.Name }); idata = GetListData(scoreBoard); ViewBag.ChartData = idata.ToArray(); return(View()); }
public ActionResult Index() { IEnumerable <HighScore> highScores = highscoreTable.GetAll(); IEnumerable <Player> players = playerTable.GetAll(); IEnumerable <Game> games = gameTable.GetAll(); try { IEnumerable <ScoreboardViewModel> scoreboard = from h in highScores join p in players on h.pID equals p.ID join g in games on h.gID equals g.ID select new ScoreboardViewModel { Highscore = h.Highscore, PlayerName = p.Name, GameMode = g.Name, lastScored = h.LastUpdated }; ViewBag.Title = "Scoreboard"; return(View(scoreboard)); } catch { return(View("Home")); } }
public ActionResult EditPlayer(PlayerViewModel playerViewModel) { try { IEnumerable <Player> listOfPlayers = _playerTable.GetAll(); playerViewModel.listOfPlayers = listOfPlayers; return(View(playerViewModel)); } catch { return(View("Error")); } }