コード例 #1
0
        public async Task <GetNextRoundOwnerResult> GetNextOwner(int gameId, int lastRoundOwnerPlayerId)
        {
            var players = await playersRepository.GetAllPlayers(gameId);

            var lastOwner = players.FirstOrDefault(x => x.PlayerId == lastRoundOwnerPlayerId);

            var nextOwner = players
                            .Where(x => x.Number > lastOwner.Number)
                            .OrderBy(x => x.Number)
                            .FirstOrDefault();

            if (nextOwner == null)
            {
                nextOwner = players
                            .OrderBy(x => x.Number)
                            .FirstOrDefault();
            }

            if (nextOwner == null)
            {
                return(new GetNextRoundOwnerResult());
            }

            return(new GetNextRoundOwnerResult(nextOwner.PlayerId));
        }
コード例 #2
0
        public IActionResult ViewPlayers()
        {
            var players = _playerRepo.GetAllPlayers();

            return(View(players));
        }