//Reset the matchups
        public ActionResult ResetRoundMatchups()
        {
            int     roundNo          = RoundMatchupActions.GetLastRoundNo(_context);
            Boolean pairRoundMatchup = false;

            foreach (RoundMatchup roundMatchup in _context.RoundMatchups.Include(r => r.PlayerTwo).Where(r => r.RoundNo == roundNo).ToList())
            {
                if (roundMatchup is PairRoundMatchup && roundMatchup.PlayerTwo != null)
                {
                    pairRoundMatchup = true;
                }

                _context.Remove(roundMatchup);
            }
            _context.SaveChanges();
            if (pairRoundMatchup == true)
            {
                if (RoundMatchupActions.GenerateNextPairRound(_context) == false)
                {
                    TempData["Errors"] = "There are no unique matchups left, manual selection will be required (Random Matchups have been allocated where opponents from last round are teammates)";
                }
            }
            else
            {
                if (RoundMatchupActions.GenerateNextRound(_context) == false)
                {
                    TempData["Errors"] = "There are no unique matchups left, manual selection will be required (Matchups are generated based on most evenly skilled players according to BattleScore, with no regard for previous opponents)";
                }
            }
            return(RedirectToAction(nameof(Index), "Admin"));
        }
        public ActionResult DisplayNextRound()
        {
            List <Player> activePlayers = _context.Players.Where(p => p.Active == true).Where(p => p.Bye == false).ToList();

            if ((activePlayers.Count() % 2) != 0)
            {
                TempData["Errors"] = "You are attempting to generate a round with an odd number of players, choose the player that should have a bye and retry";
                return(RedirectToAction(nameof(Index), "Players"));
            }
            if (RoundMatchupActions.GenerateNextRound(_context) == false)
            {
                TempData["Errors"] = "There are no unique matchups left, manual selection will be required (Matchups are generated based on most evenly skilled players according to BattleScore, with no regard for previous opponents)";
            }
            return(RedirectToAction(nameof(Index), "Admin"));
        }
示例#3
0
        //Reset the matchups
        public ActionResult ResetRoundMatchups()
        {
            int     roundNo          = RoundMatchupActions.GetLastRoundNo(_context);
            Boolean pairRoundMatchup = false;

            foreach (RoundMatchup roundMatchup in _context.RoundMatchups.Where(r => r.RoundNo == roundNo).ToList())
            {
                if (roundMatchup is PairRoundMatchup)
                {
                    pairRoundMatchup = true;
                }
                _context.Remove(roundMatchup);
            }
            _context.SaveChanges();
            if (pairRoundMatchup == true)
            {
                RoundMatchupActions.GenerateNextPairRound(_context);
            }
            else
            {
                RoundMatchupActions.GenerateNextRound(_context);
            }
            return(RedirectToAction(nameof(Index), "Admin"));
        }
示例#4
0
 public ActionResult DisplayNextRound()
 {
     RoundMatchupActions.GenerateNextRound(_context);
     return(RedirectToAction(nameof(Index)));
 }
示例#5
0
 //Generate the RoundMatchups
 public ActionResult GenerateRoundMatchups()
 {
     RoundMatchupActions.GenerateNextRound(_context);
     return(RedirectToAction("Index", "Admin"));
 }