public async Task <GetRoundGameView> GetRound(int gameId) { Game game = await _gameRepository.Get(gameId); if (game == null) { var stringBuilder = new StringBuilder(); stringBuilder.AppendLine(string.Format("GameId: {0}", gameId)); stringBuilder.AppendLine(string.Format("Message: {0}", SolutionConstants.BUSINESS_LOGIC_GET_ITEM_EXCEPTION_MESSAGE)); string message = stringBuilder.ToString(); throw new BusinessLogicGetItemException(message); } var responseView = new GetRoundGameView(); if (!game.IsFinished) { Round round = await _roundRepository.GetLastRound(gameId); var newRound = new Round(); newRound.GameId = gameId; newRound.NumberOfRound = round != null ? (round.NumberOfRound + GameConstants.NEXT_ROUND) : GameConstants.FIRST_ROUND; await SetFinishedGameIfEndedRounds(newRound.NumberOfRound, game); await _roundRepository.Create(newRound); responseView.RoundId = newRound.Id; responseView.NumberOfRound = newRound.NumberOfRound; } return(responseView); }