//Får data fra mange-mange tablet mellem Film og skuespiller
        public static List <ActorInMovie> GetActorInMovies()
        {
            List <ActorInMovie> actorInMovies = new List <ActorInMovie>();

            using (SqlConnection connection = new SqlConnection(cs))
            {
                connection.Open();

                SqlCommand cmd = new SqlCommand("select movie_id, actor_id from movie_actor", connection);

                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    //henter data fra readeren og "caster"
                    //til den rigtige datatype
                    int movie_id = (int)rdr["movie_id"];
                    int actor_id = (int)rdr["actor_id"];

                    //Opretter et ny ActorInMovie objekt
                    ActorInMovie a = new ActorInMovie(movie_id, actor_id);
                    //tilføjer ActorInMovie til listen
                    actorInMovies.Add(a);
                }
            }

            return(actorInMovies);
        }
        public static void DeleteActorInMovie(ActorInMovie a)
        {
            using (SqlConnection connection = new SqlConnection(cs))
            {
                //Opretter en forbindelse til databasen
                connection.Open();
                //update data
                SqlCommand cmd = new SqlCommand
                                     ("Delete from movie_actor where movie_id = @m_id and actor_id = @a_id",
                                     connection);
                //tilføjer parametre
                cmd.Parameters.Add(new SqlParameter("@m_id", a.Movie_id));
                cmd.Parameters.Add(new SqlParameter("@a_id", a.Actor_id));

                cmd.ExecuteNonQuery();

                //Id sættes ind i a
            }
        }
        public static void InsertActorInMovie(ActorInMovie a)
        {
            using (SqlConnection connection = new SqlConnection(cs))
            {
                //Opretter en forbindelse til databasen
                connection.Open();
                //update data
                SqlCommand cmd = new SqlCommand
                                     ("insert into movie_actor(movie_id, actor_id) values (@m_id, @a_id)",
                                     connection);
                //tilføjer parametre
                cmd.Parameters.Add(new SqlParameter("@m_id", a.Movie_id));
                cmd.Parameters.Add(new SqlParameter("@a_id", a.Actor_id));

                cmd.ExecuteNonQuery();

                //Id sættes ind i a
            }
        }
 public static void DeleteActorInMovie(ActorInMovie a)
 {
     DalManager.DeleteActorInMovie(a);
 }
 public static void InsertActorInMovie(ActorInMovie a)
 {
     DalManager.InsertActorInMovie(a);
 }