public async Task <IActionResult> Index() { var cachedTopMovies = await _memoryCache.GetOrCreateAsync("TopMovies", async entry => { entry.SlidingExpiration = TimeSpan.FromHours(2); var movies = await movieServices.GetAllMoviesAsync(); return(movies.OrderByDescending(m => m.MovieScore) .Take(10) .Select(m => new MovieViewModel(m)) .ToList()); }); return(View(cachedTopMovies)); }
public async Task <ActionResult <IEnumerable <MovieManagement> > > GetAllMovieMgmt() { var result = await _movieservices.GetAllMoviesAsync(); return(Ok(result)); }