Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        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());
        }
Ejemplo n.º 3
0
        // 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());
        }
Ejemplo n.º 4
0
        public ActionResult LosingStreak()
        {
            var table = Players.Active().OrderByDescending(p => p.CurrentLosingStreak);

            if (!table.Any())
            {
                return(Redirect("~/Players/NewLeague"));
            }

            ViewData.Model = table;
            return(View());
        }
Ejemplo n.º 5
0
        // 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());
        }