Ejemplo n.º 1
0
        public override void Execute()
        {
            var rounds = _roundService.GetAllRounds();

            foreach (var round in rounds)
            {
                Console.WriteLine($"Round {round.RoundNumber} had {round.EntrantPlayerIds.Count} elections");
            }
        }
Ejemplo n.º 2
0
        public override void Execute()
        {
            var rounds   = _roundService.GetAllRounds();
            var maxRound = rounds.Max(a => a.RoundNumber);

            Console.WriteLine($"There are {maxRound} Rounds - which one would you like to view?");
            var roundIdString = Console.ReadLine()?.Trim();
            int roundId;

            if (!int.TryParse(roundIdString, out roundId))
            {
                Console.WriteLine("Input was an invalid number.");
            }

            var round = rounds.Single(a => a.RoundNumber == roundId);

            Console.WriteLine($"Round {round.RoundNumber} took place on {round.Date}, ID is {round.Id}");

            Console.WriteLine("The following elections were made:");
            foreach (var playerId in round.EntrantPlayerIds)
            {
                var player = _playerService.GetPlayer(playerId);
                Console.WriteLine($" - {player.Name} ({player.Id})");
            }

            if (round.IsOpen)
            {
                Console.WriteLine("This is the current, open Round.");
            }
            else if (round.WinningPlayerId.HasValue)
            {
                var winner = _playerService.GetPlayer(round.WinningPlayerId.Value);
                Console.WriteLine($"The winner was {winner.Name}");
            }
            else
            {
                Console.WriteLine("No winner is listed, which means that this is a legacy Round");
            }
        }