示例#1
0
        public IActionResult GetHighScores(int top)
        {
            if (top < 0)
            {
                return(BadRequest());
            }
            List <HighScoreDtoRead> highscores = new List <HighScoreDtoRead>();

            foreach (HighScoreModel highscore in _highScoreService.GetHighScores(top))
            {
                if (highscore != null)
                {
                    highscores.Add(_mapper.Map <HighScoreDtoRead>(highscore));
                }
            }

            return(Ok(highscores));
        }
示例#2
0
        public void HandleRequest(IRequest request)
        {
            var result = _highScoreService.GetHighScores(_timeRange).ToDictionary("h", h => h.ToDictionary());

            Message.Builder.FromRequest(request).WithData(result).WithEmpty().Send();
        }