예제 #1
0
        public IActionResult GetTable(int leagueId)
        {
            var result = _leagueTableService.GetLeagueTable(leagueId);

            if (result.ErrorOccurred)
            {
                return(BadRequest(result));
            }

            return(Ok(result));
        }
예제 #2
0
        public ActionResult <IEnumerable <LeagueTableItem> > LeagueTable()
        {
            IEnumerable <LeagueTableItem> league;
            var username = GetUserName();

            if (!cache.TryGetValue("leaguetable", out league))
            {
                league = leagueTableService.GetLeagueTable(username);

                var cacheEntryOptions = new MemoryCacheEntryOptions()
                                        .SetAbsoluteExpiration(TimeSpan.FromHours(1));
                cache.Set("leaguetable", league, cacheEntryOptions);
            }
            logger.Debug($"leagueTable returned to {GetUserName()}");
            return(Ok(league));
        }