예제 #1
0
        public async Task <IActionResult> Index(string id)
        {
            var json = await movieServices.GetByIDAsync(id);

            MovieFull      movieFull        = JsonConvert.DeserializeObject <MovieFull>(json);
            var            commentsForMovie = _moviedb.Comments.Where(comment => comment.MovieImdbApi == id);
            List <AppUser> users            = new List <AppUser>();

            foreach (var comment in commentsForMovie)
            {
                var user = await _userManager.FindByIdAsync(comment.UserId);

                users.Add(user);
            }

            MovieInfoViewModel viewModel = new MovieInfoViewModel {
                Movie = movieFull, comments = commentsForMovie, userEmails = users
            };

            return(View(viewModel));
        }