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)); }
public IActionResult ViewPlayers() { var players = _playerRepo.GetAllPlayers(); return(View(players)); }