public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var actor = await _context.Actor
                        .SingleOrDefaultAsync(m => m.ActorID == id);

            if (actor == null)
            {
                return(NotFound());
            }

            ActorIndexViewData viewModel = new ActorIndexViewData();
            var movies = from role in _context.MovieRole
                         where role.ActorID == id
                         select role.Movie;
            var movieRoles = from role in _context.MovieRole
                             where role.ActorID == id
                             select role;

            viewModel.Movies     = movies;
            viewModel.Actor      = actor;
            viewModel.MovieRoles = movieRoles;

            return(View(viewModel));
        }
        // GET: Actors/Edit/5
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var actor = await _context.Actor.SingleOrDefaultAsync(m => m.ActorID == id);

            if (actor == null)
            {
                return(NotFound());
            }

            ActorRoleAdditionData viewModel          = new ActorRoleAdditionData();
            ActorIndexViewData    actorIndexViewData = new ActorIndexViewData();
            var allMovies = from movie in _context.Movie
                            select movie.Title;
            var movies = from role in _context.MovieRole
                         where role.ActorID == id
                         select role.Movie;
            var movieRoles = from role in _context.MovieRole
                             where role.ActorID == id
                             select role;

            viewModel.Movies              = new SelectList(await allMovies.ToListAsync());
            actorIndexViewData.Movies     = movies;
            actorIndexViewData.Actor      = actor;
            actorIndexViewData.MovieRoles = movieRoles;
            viewModel.ActorIndexViewData  = actorIndexViewData;

            return(View(viewModel));
        }