Exemple #1
0
        public static List <YouTubePage> GetAll()
        {
            List <YouTubePage> allYouTubePages = new List <YouTubePage> {
            };
            MySqlConnection conn = DB.Connection();

            conn.Open();
            MySqlCommand cmd = conn.CreateCommand() as MySqlCommand;

            cmd.CommandText = @"SELECT * FROM youtubepages;";
            MySqlDataReader rdr = cmd.ExecuteReader() as MySqlDataReader;

            while (rdr.Read())
            {
                int         itemId          = rdr.GetInt32(0);
                string      itemTitle       = rdr.GetString(1);
                string      itemDescription = rdr.GetString(2);
                string      itemLink        = rdr.GetString(3);
                YouTubePage newYouTubePage  = new YouTubePage(itemTitle, itemDescription, itemLink, itemId);
                allYouTubePages.Add(newYouTubePage);
            }
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
            return(allYouTubePages);
        }
Exemple #2
0
 public override bool Equals(System.Object otherYouTubePage)
 {
     if (!(otherYouTubePage is YouTubePage))
     {
         return(false);
     }
     else
     {
         YouTubePage newYouTubePage      = (YouTubePage)otherYouTubePage;
         bool        idEquality          = (this.Id == newYouTubePage.Id);
         bool        descriptionEquality = (this.Description == newYouTubePage.Description);
         bool        titleEquality       = (this.Title == newYouTubePage.Title);
         bool        linkEquality        = (this.Link == newYouTubePage.Link);
         return(idEquality && descriptionEquality && titleEquality && linkEquality);
     }
 }
Exemple #3
0
 public void AddYouTubePage(YouTubePage YouTubePage)
 {
     YouTubePages.Add(YouTubePage);
 }
Exemple #4
0
        public static YouTubePage Find(int searchId)
        {
            YouTubePage placeholderYouTubePage = new YouTubePage("placeholder item", "other thhing", "other thing");

            return(placeholderYouTubePage);
        }