Ejemplo n.º 1
0
        public async Task <IActionResult> List()
        {
            string accessToken = await HttpContext.GetToken();

            var session = await sessionService.GetSession(accessToken);

            if (session == null)
            {
                return(Unauthorized(new { message = "Session expired. Please login again." }));
            }

            try
            {
                var res = await statsRepository.GetHighScores();

                return(Ok(res));
            }
            catch (Exception ex)
            {
                await log.ErrorAsync("Error in statsRepository.GetHighScores()", ex);

                return(BadRequest(new { title = ex.GetType().ToString(), details = ex.StackTrace, message = ex.Message }));
            }
        }