コード例 #1
0
ファイル: AdminController.cs プロジェクト: HodaHanafy/Movies
        public ActionResult ActorDetails(int Id)
        {
            if (Session["UserId"] == null)
            {
                RedirectToAction("Login", new { Controller = "Home" });
            }

            Actor actor = db.Actors.Find(Id);


            if (actor != null)
            {
                ActorMoviesViewModel AMVM = new ActorMoviesViewModel();

                AMVM.actor = actor;

                List <Movie> MoviesList = db.MOVIESS.Where(y => y.Cast.Contains(actor.full_name.ToLower())).ToList();

                AMVM.ActorMovies = MoviesList;

                return(View(AMVM));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
コード例 #2
0
        public ActionResult GetMoviesByActor()
        {
            var viewModel = new ActorMoviesViewModel
            {
                Actors = repository.GetActors().Select(m =>
                                                       new SelectListItem(m.Name, m.Id.ToString())).ToList()
            };

            return(View(viewModel));
        }
コード例 #3
0
        public ActionResult getMovies(string actorName)
        {
            Actor actor = new Actor(actorName);

            List <Movie> movies = new List <Movie>();

            movies = actor.getMovies();
            actorMoviesViewModel        = new ActorMoviesViewModel();
            actorMoviesViewModel.actor  = actor;
            actorMoviesViewModel.movies = movies;

            return(RedirectToAction("MoviesOfActor", "MoviesOfActor", false));
        }