public IEnumerable <IPodcast> GetAllPodcastByUserID(int id)
        {
            _connection.SqlConnection.Open();

            String        query = "SELECT * FROM Podcast WHERE PlaylistID = (SELECT ID FROM Playlist WHERE UserID = @UserID)";
            SqlDataReader reader;

            using (SqlCommand command = new SqlCommand(query, _connection.SqlConnection))
            {
                command.Parameters.AddWithValue("@UserID", id);
                reader = command.ExecuteReader();
            }

            var podcastList = new List <IPodcast>();

            while (reader.Read())
            {
                var podcast = new PodcastDTO
                {
                    Title          = reader["Title"].ToString(),
                    Description    = reader["Description"].ToString(),
                    Image          = (byte[])reader["Image"],
                    CreationDate   = Convert.ToDateTime(reader["CreationDate"]),
                    AgeRestriction = Convert.ToInt32(reader["AgeRestriction"])
                };

                podcastList.Add(podcast);
            }

            return(podcastList);
        }
        public IEnumerable <IPodcast> GetAllPodcasts()
        {
            _connection.SqlConnection.Open();

            String        query   = "Select * From Podcast";
            SqlCommand    command = new SqlCommand(query, _connection.SqlConnection);
            SqlDataReader reader  = command.ExecuteReader();

            var podcastList = new List <IPodcast>();

            while (reader.Read())
            {
                var podcast = new PodcastDTO
                {
                    ID             = Convert.ToInt32(reader["ID"]),
                    PlaylistID     = Convert.ToInt32(reader["PlaylistID"]),
                    Title          = reader["Title"].ToString(),
                    Description    = reader["Description"].ToString(),
                    Image          = (byte[])reader["PodcastPicture"],
                    CreationDate   = Convert.ToDateTime(reader["CreationDate"]),
                    AgeRestriction = Convert.ToInt32(reader["AgeRestriction"]),
                    AudioPath      = reader["PodcastAudioPath"].ToString()
                };

                podcastList.Add(podcast);
            }

            return(podcastList);
        }