public IActionResult GetTable(int leagueId) { var result = _leagueTableService.GetLeagueTable(leagueId); if (result.ErrorOccurred) { return(BadRequest(result)); } return(Ok(result)); }
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)); }