Ejemplo n.º 1
0
        public async Task <IActionResult> GoToAction(string submitButton, [Bind("Id,RoundNo,NoTableTops,Players,RoundMatchups")] RoundsModel Round)
        {
            switch (submitButton)
            {
            case "GoToDisplayNextRound":
                // delegate sending to another controller action
                if (ModelState.IsValid)
                {
                    _context.Add(Round);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction("DisplayNextRound", "RoundMatchups"));
                }
                break;

            case "GoToDisplayNextPairRound":
                // call another action to perform the cancellation
                if (ModelState.IsValid)
                {
                    _context.Add(Round);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction("DisplayNextPairRound", "RoundMatchups"));
                }
                break;

            default:
                // If they've submitted the form without a submitButton,
                // just return the view again.
                return(View(Round));
            }
            return(View(Round));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> GoToDisplayNextPairRound([Bind("Id,NoTableTops,NoTableTops,Players,RoundMatchups")] RoundsModel Round)
        {
            if (_context.RoundsModel.Count() == 0)
            {
                // Round.RoundNo = 1;
            }
            else
            {
                //Round.RoundNo = _context.RoundsModel.Last().RoundNo + 1;
            }

            if (ModelState.IsValid)
            {
                _context.Add(Round);
                await _context.SaveChangesAsync();

                return(RedirectToAction("DisplayNextPairRound", "RoundMatchups"));
            }

            return(View(Round));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> PlayersDisplay()
        {
            List <Player> players = await _context.Players.ToListAsync();

            ViewData["Errors"] = TempData["Errors"];
            Tournament tournament = _context.Tournaments.First();

            foreach (Player player in players)
            {
                player.WeightedScore = ((int)(player.BattleScore * tournament.BattleScoreRatio) + (int)(player.SportsmanshipScore * tournament.SportsmanshipScoreRatio) + (int)(player.ArmyScore * tournament.ArmyScoreRatio));
            }
            players = players.OrderByDescending(p => p.WeightedScore).ToList();
            //  return View(players);
            var display = new RoundsModel();

            if (_context.RoundsModel.Count() > 0)
            {
                display.NoTableTops = _context.RoundsModel.Last().NoTableTops;
            }
            display.Players = players;
            return(View(display));
        }