コード例 #1
0
 public IActionResult GetAll()
 {
     try
     {
         var stats = _statsService.GetAll();
         return(Ok(stats));
     }
     catch (Exception ex)
     {
         var exc = ex.InnerException ?? ex;
         return(StatusCode((int)HttpStatusCode.InternalServerError, exc));
     }
 }
コード例 #2
0
        public async Task <IActionResult> stats()
        {
            try
            {
                List <StatsSummaryModel> m = await _statsService.GetAll();

                if (m.Count < 1)
                {
                    return(NotFound());
                }

                return(Ok(m));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Error within Get Stats: {ex.Message}");
                return(StatusCode(500, "Internal server error"));
            }
        }
コード例 #3
0
 public async Task <List <NamedAPIResource> > GetAll(int limit, int offset)
 => await _memoryCache.GetOrCreateAsync(
     $"{_typeName}-GetAll-{limit}-{offset}",
     entry => _statsService.GetAll(limit, offset));