public async Task <IActionResult> FavoriteMovies()
        {
            var user = await _userManager.GetUserAsync(User);

            bool isVipUser = false;

            if (user != null)
            {
                isVipUser = _paymentService.CheckUserVipAccount(user.Id);
            }
            ;
            ViewBag.IsUserVip = isVipUser;
            //
            if (isVipUser)
            {
                var result      = new List <MovieDetailResponse>();
                var lstMovieIds = _movieFavoritesService.GetMovieFavoritesIdByUserId(user.Id);
                if (lstMovieIds == null)
                {
                    return(View(result));
                }
                result = await _movieService.GetListMovieDetailsByListMovieId(lstMovieIds);

                return(View(result));
            }

            return(RedirectToAction("Index", "Home"));
        }
Beispiel #2
0
        public async Task <ActionResult <List <MovieDetailResponse> > > GetMovieFavorites(string userId)
        {
            var result      = new List <MovieDetailResponse>();
            var lstMovieIds = _movieFavoritesService.GetMovieFavoritesIdByUserId(userId);

            if (lstMovieIds == null)
            {
                return(result);
            }

            //foreach (var item in lstMovieIds)
            //{
            //    MovieRequest request = new MovieRequest();
            //    request.Api_key = _api_key;
            //    request.Language = "en-US";
            //    request.Movie_id = item;
            //    var movieDetail = await _movieService.GetMovieDetail(request);
            //    result.Add(movieDetail);
            //}
            result = await _movieService.GetListMovieDetailsByListMovieId(lstMovieIds);

            return(result);
        }