Exemple #1
0
        protected void ActorButton_Click(object sender, EventArgs e)
        {
            List <Actor> Actors = MovieNight.GetActors();

            foreach (var item in Actors)
            {
                //Create a Row
                TableRow row = new TableRow();

                //create cells
                TableCell SID       = new TableCell();
                TableCell Firstname = new TableCell();
                TableCell Lastname  = new TableCell();
                TableCell Fullname  = new TableCell();

                //Add text to cells
                SID.Text       = item.Actor_SID.ToString();
                Firstname.Text = item.Actor_Firstname;
                Lastname.Text  = item.Actor_Lastname;
                Fullname.Text  = $"{item.Actor_Firstname} {item.Actor_Lastname}";

                //add cells to current row
                row.Cells.Add(SID);
                row.Cells.Add(Firstname);
                row.Cells.Add(Lastname);
                row.Cells.Add(Fullname);

                //add row to table
                ActorsTable.Rows.Add(row);
            }
        }
        protected void SearchMovieButton_Click(object sender, EventArgs e)
        {
            List <Movie> Movies = MovieNight.SearchForMovies(SearchTextBox.Text);

            foreach (var item in Movies)
            {
                //Create a Row
                TableRow row = new TableRow();

                //create cells
                TableCell id    = new TableCell();
                TableCell title = new TableCell();
                TableCell year  = new TableCell();
                TableCell genre = new TableCell();
                TableCell imdb  = new TableCell();

                //Add text to cells
                id.Text    = item.Movie_ID.ToString();
                title.Text = item.Movie_Title;
                year.Text  = item.Movie_Year.ToString();
                genre.Text = item.Movie_Genre;
                imdb.Text  = item.Movie_IMDB;

                //add cells to current row
                row.Cells.Add(id);
                row.Cells.Add(title);
                row.Cells.Add(year);
                row.Cells.Add(genre);
                row.Cells.Add(imdb);

                //add row to table
                MoviesTable.Rows.Add(row);
            }
        }
 protected void AddMovieButton_Click(object sender, EventArgs e)
 {
     try
     {
         MovieNight.InsertMovie(new Movie(AM_Title.Text, int.Parse(AM_Year.Text), AM_Genre.Text, AM_Review.Text));
         AlertBox.CssClass = "alert alert-success";
         AlertBox.Text     = "Successfully added movie!";
     }
     catch
     {
         AlertBox.CssClass = "alert alert-warning";
         AlertBox.Text     = "Something went wrong!";
     };
 }