Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                MovieServices       listmovie = new MovieServices();
                MoviePeopleServices castlist  = new MoviePeopleServices();

                List <MovieModelDTO> ListOfAllMovies = new List <MovieModelDTO>();
                ListOfAllMovies          = listmovie.GetAllMovies();
                ddlTitleMovie.DataSource = ListOfAllMovies;
                ddlTitleMovie.DataBind();
                ddlTitleMovie.Items.Insert(0, new ListItem("<-Choose Movie->", "0"));
                //-------------------------------------------------------------------------

                List <MovieModelDTO> ListOfYears = listmovie.GetAllYears();

                List <string> Years = new List <string>();
                foreach (var item in ListOfYears)
                {
                    string year = item.Year;
                    Years.Add(year);
                }
                ddlYearMovie.DataSource = Years.ToList().Distinct();
                ddlYearMovie.DataBind();
                ddlYearMovie.Items.Insert(0, new ListItem("<-Choose Year->", "0"));

                //-----------------------------
                List <MoviePersonDTO> ListOfAcotrs = castlist.GetActors();

                ddlActorMovie.DataTextField  = "FirstName";
                ddlActorMovie.DataValueField = "LastName";
                ddlActorMovie.DataSource     = ListOfAcotrs;
                ddlActorMovie.DataBind();
                ddlActorMovie.Items.Insert(0, new ListItem("<-Choose Actor->", "0"));
                //----------------------------------------------


                List <MoviePersonDTO> ListOfProducers = castlist.GetProducers();

                ddlProducerMovie.DataTextField  = "FirstName";
                ddlProducerMovie.DataValueField = "LastName";
                ddlProducerMovie.DataSource     = ListOfProducers;
                ddlProducerMovie.DataBind();
                ddlProducerMovie.Items.Insert(0, new ListItem("<-Choose Producer->", "0"));
                //-------------------------------------------------------

                //genre to bind
                ddlGenreMovie.DataSource = listmovie.GetAllGenres();
                ddlGenreMovie.DataBind();
                ddlGenreMovie.Items.Insert(0, new ListItem("<-Choose Genre->", "0"));


                //repeater to bind
                List <MovieModelDTO> ListOfMovies = new List <MovieModelDTO>();
                ListOfMovies             = listmovie.GetAllMovies();
                RepeaterMovie.DataSource = ListOfMovies;
                RepeaterMovie.DataBind();
            }
        }
Exemple #2
0
        public void RunMenu()
        {
            int choice = 0;

            do
            {
                Menu m = new Menu();
                choice = m.Print_2();
                switch (choice)
                {
                case (int)MenuOptions.SearchById:
                    movieServices.GetById();
                    break;

                case (int)MenuOptions.SearchByName:
                    movieServices.GetByName();
                    break;

                case (int)MenuOptions.PrintAll:
                    movieServices.GetAllMovies();
                    break;

                case (int)MenuOptions.Exit:
                    Console.WriteLine("Thanks for visit. Please Visit again !!!!");
                    break;

                default:
                    Console.WriteLine("Invalid Option");
                    break;
                }
                Console.WriteLine("Press Enter to continue......");
                Console.ReadLine();
                Console.Clear();
            } while (choice != (int)MenuOptions.Exit);
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                MainMoviePeople1.SetLabelText("Search Actors by Movie Title", "Search Actor by Name");
            }
            MovieServices movieList = new MovieServices();
            GridView      MovieGrid = new GridView();

            MovieGrid            = MainMoviePeople1.GridMovieList;
            MovieGrid.DataSource = movieList.GetAllMovies();
            MovieGrid.DataBind();
            GetAppropriateView(MovieGrid);
        }
 public async Task <List <Movie> > GetAllMovies()
 {
     return(await movieServices.GetAllMovies());
 }
        //GET:all movies
        public ActionResult Index()
        {
            var movies = movieService.GetAllMovies();

            return(View(movies));
        }
Exemple #6
0
        public ActionResult Edit(int id)
        {
            var movie = movieServices.GetAllMovies().First(f => f.Id == id);

            return(View(movie));
        }