public ActionResult Create() { var createGameView = new ViewModels.CreateGame { Players = Players.Active().Select(p => p.Name).OrderBy(n => n), RecentGames = Games.MostRecent(5, Games.GamesSortOrder.MostRecentFirst) }; ViewData.Model = createGameView; return(View()); }
public ActionResult Index() { var leaderboard = Players.Active().Where(p => p.GamesPlayed > 0).OrderByDescending(p => p.Rating); if (!leaderboard.Any()) { return(Redirect("~/Players/NewLeague")); } ViewData.Model = leaderboard; return(View()); }
// GET: Tables public ActionResult Rating() { var table = Players.Active().OrderByDescending(p => p.Rating); if (!table.Any()) { return(Redirect("/Players/NewLeague")); } ViewData.Model = table; return(View()); }
public ActionResult LosingStreak() { var table = Players.Active().OrderByDescending(p => p.CurrentLosingStreak); if (!table.Any()) { return(Redirect("~/Players/NewLeague")); } ViewData.Model = table; return(View()); }
// GET: Players/Records public ActionResult Records() { var activePlayers = Players.Active(); if (!activePlayers.Any()) { return(Redirect("~/Players/NewLeague")); } var recordsView = new Records { CurrentTopRanked = activePlayers.MaxByAll(p => p.Rating), MostRatingsPointsEver = activePlayers.MaxByAll(p => p.MaxRating), BestWinRate = activePlayers.MaxByAll(p => p.WinRate), LongestWinningStreak = activePlayers.MaxByAll(p => p.LongestWinningStreak), CurrentWinningStreak = activePlayers.MaxByAll(p => p.CurrentWinningStreak), LongestLosingStreak = activePlayers.MaxByAll(p => p.LongestLosingStreak), CurrentLosingStreak = activePlayers.MaxByAll(p => p.CurrentLosingStreak), }; ViewData.Model = recordsView; return(View()); }