示例#1
0
        public async Task <GetHistoryOfWins> GetHistoryOfWins(int gameId)
        {
            List <Round> rounds = await _roundRepository.GetAllRoundsByGameId(gameId);

            if (rounds == 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 GetHistoryOfWins();

            foreach (Round round in rounds)
            {
                SetHistoryOfWinsViewItem(responseView, round);
            }

            return(responseView);
        }