Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DirectorManager manager = new DirectorManager();

            AllDirectors = manager.GetAll();
            if (!IsPostBack)
            {
                DoDataBind();
            }
            else
            {
                AllDirectors = manager.GetAll();
            }
            manager.Dispose();
        }
Beispiel #2
0
 private void GetAllDirectors()
 {
     foreach (var director in directorManager.GetAll().Data)
     {
         comboBox1.Items.Add($"{director.FirstName} {director.LastName}");
     }
 }
Beispiel #3
0
 private void GetAllDirectors()
 {
     listView1.Items.Clear();
     foreach (var director in directorManager.GetAll().Data)
     {
         string[] row   = { director.Id.ToString(), director.FirstName, director.LastName, director.Nationality, director.Birth.ToString() };
         var      drctr = new ListViewItem(row);
         listView1.Items.Add(drctr);
     }
 }
Beispiel #4
0
        private void DoDataBind()
        {
            DirectorManager manager = new DirectorManager();

            DirectorsDropdownList.DataValueField = "Id";
            DirectorsDropdownList.DataTextField  = "FullName";
            DirectorsDropdownList.DataSource     = manager.GetAll();
            DirectorsDropdownList.DataBind();
            UpdateTextBoxes();
            manager.Dispose();
        }
        public ActionResult Index()
        {
            List <Director> directors;

            using (manager = new DirectorManager())
            {
                directors = manager.GetAll();
            }

            return(View(directors));
        }
Beispiel #6
0
        private void UpdateTextBoxes()
        {
            DirectorManager manager = new DirectorManager();

            AllDirectors = manager.GetAll();
            if (AllDirectors.Count > 0)
            {
                int index            = DirectorsDropdownList.SelectedIndex;
                var selectedDirector = AllDirectors[index];
                FirstNameTextBox.Text = selectedDirector.FirstName;
                LastNameTextBox.Text  = selectedDirector.LastName;
            }
        }
        public ActionResult Create()
        {
            MovieViewModel viewModel = new MovieViewModel();

            viewModel.Movie = new Movie();
            using (GenreManager genreManager = new GenreManager())
            {
                viewModel.PossibleGenres = genreManager.GetAll();
            }
            using (RatingManager ratingManager = new RatingManager())
            {
                viewModel.PossibleRatings = ratingManager.GetAll();
            }
            using (DirectorManager directorManager = new DirectorManager())
            {
                viewModel.PossibleDirectors = directorManager.GetAll();
            }
            using (FormatManager formatManager = new FormatManager())
            {
                viewModel.PossibleFormats = formatManager.GetAll();
            }

            return(View(viewModel));
        }
Beispiel #8
0
        public void Get_All_Returns_More_Than_One()
        {
            var all = manager.GetAll();

            Assert.IsTrue(all.Count > 1);
        }
        public ActionResult Edit(int id)
        {
            Movie movie = new Movie();

            using (manager = new MovieManager())
            {
                movie = manager.GetById(id);
            }
            if (movie == null)
            {
                return(HttpNotFound());
            }
            else
            {
                MovieViewModel vm = new MovieViewModel();
                using (GenreManager genreManager = new GenreManager()) { vm.PossibleGenres = genreManager.GetAll(); }
                using (RatingManager ratingManager = new RatingManager()) { vm.PossibleRatings = ratingManager.GetAll(); }
                using (DirectorManager directorManager = new DirectorManager()) { vm.PossibleDirectors = directorManager.GetAll(); }
                using (FormatManager formatManager = new FormatManager()) { vm.PossibleFormats = formatManager.GetAll(); }
                //vm.MovieId = movie.Id;
                vm.Movie            = movie;
                vm.MovieDescription = movie.Description;
                vm.MovieCost        = movie.Cost;
                vm.MovieTitle       = movie.Title;
                vm.ImagePath        = movie.ImagePath;

                vm.CurrentGenres = new List <int>();
                foreach (var a in movie.Genres)
                {
                    vm.CurrentGenres.Add(a.Id);
                }
                return(View(vm));
            }
        }