Exemple #1
0
        public List <Playlist> ViewVolgend(int gebruikerid)
        {
            string        sql        = "SELECT PlaylistID FROM Volgersperlijst WHERE GebruikerID = @id";
            List <int>    Playlistid = new List <int>();
            SqlConnection con        = new SqlConnection(Connectionstring);
            SqlCommand    cmd        = new SqlCommand(sql, con);

            con.Open();
            cmd.Parameters.AddWithValue("@id", gebruikerid);
            SqlDataReader rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                Playlistid.Add(rdr.GetInt32(0));
            }
            var model = new List <Playlist>();

            con.Close();
            foreach (int i in Playlistid)
            {
                string     sql2 = "SELECT * FROM Playlist WHERE PlaylistID = @playlistid";
                SqlCommand cmd2 = new SqlCommand(sql2, con);
                con.Open();
                cmd2.Parameters.AddWithValue("@playlistid", i);
                SqlDataReader rdr2 = cmd2.ExecuteReader();
                while (rdr2.Read())
                {
                    model.Add(Lijsten.GetPlaylistData(rdr2));
                }
                con.Close();
            }
            return(model);
        }
Exemple #2
0
        public List <Playlist> ViewOpenbaarPlaylist()
        {
            string sql   = "SELECT * FROM Playlist WHERE Openbaar = 1";
            var    model = new List <Playlist>();

            using (SqlConnection con = new SqlConnection(Connectionstring))
            {
                con.Open();
                SqlCommand    cmd = new SqlCommand(sql, con);
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    model.Add(Lijsten.GetPlaylistData(rdr));
                }
                con.Close();
            }
            return(model);
        }
Exemple #3
0
        public List <Playlist> ViewMyPlayList(int id)
        {
            string        sql   = "SELECT * FROM Playlist WHERE (GemaaktdoorID = @gebruikersid)";
            var           model = new List <Playlist>();
            SqlConnection con   = new SqlConnection(Connectionstring);

            con.Open();
            SqlCommand cmd = new SqlCommand(sql, con);

            cmd.Parameters.AddWithValue("@gebruikersid", id);
            cmd.ExecuteNonQuery();
            SqlDataReader rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                model.Add(Lijsten.GetPlaylistData(rdr));
            }
            con.Close();
            return(model);
        }