コード例 #1
0
        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));
        }
コード例 #2
0
        public async Task <ActionResult <IEnumerable <MovieManagement> > > GetAllMovieMgmt()
        {
            var result = await _movieservices.GetAllMoviesAsync();

            return(Ok(result));
        }