コード例 #1
0
        public async Task <IActionResult> getTopScores([Required] string area, int length = 10)
        {
            try
            {
                IEnumerable <Score> scores = await _scoreRepo.GetTopScoresAsync(area.ToUpper(), length);

                foreach (Score s in scores)
                {
                    s.User.PasswordHash = null;
                }
                return(Ok(scores));
            }
            catch (Exception e)
            {
                _logger.LogError($"\r\n\r\nError thrown on ScoresController - GetTopScores method (" + DateTime.UtcNow.ToString() + ") \r\nException thrown when trying to Get Top Scores: " + e + "\r\n\r\n");
                return(BadRequest("Failed to get top scores"));
            }
        }