Ejemplo n.º 1
0
        public video getVideo(int vidID)
        {
            vidID = 1;
            video newVideo = new video();

            connection_string = ConfigurationManager.ConnectionStrings
                                ["Fake_Tube.Properties.Settings.Faketube_databaseConnectionString"].ConnectionString;
            connection = new SqlConnection(connection_string);
            connection.Open();

            SqlCommand cmd = new SqlCommand("EXEC populateVideo @videoID = '" + vidID + "'", connection);

            using (SqlDataAdapter adapter = new SqlDataAdapter(cmd))
            {
                DataTable video = new DataTable();
                adapter.Fill(video);


                foreach (DataRow row in video.Rows)
                {
                    int.TryParse(row["Id"].ToString(), out newVideo.videoId);
                    newVideo.setCreatorName(row["channelName"].ToString());
                    newVideo.setDislikes(100);
                    newVideo.setLikes(101);
                    newVideo.setName(row["name"].ToString());
                    newVideo.setOwnerId(1);
                    newVideo.setURL(row["video_url"].ToString());
                }
            }
            connection.Close();
            return(newVideo);
        }
Ejemplo n.º 2
0
        public List <video> getVidoesfromVidoeIds(List <int> videoIds)
        {
            List <video> videos = new List <video>();

            // Temp
            video v  = new video(1, 1, 1, 1, 1, "great Video", "c:/vidoes/are_our_children_learning_enough_about_whales_POi4rvN_Yts_360p.mp4", "bobthebombdotcom", "the best discription ever");
            video v2 = new video(2, 1, 1, 1, 1, "even Better Vid", "c:/vidoes/12_smartphone_gadgets_you_might_not_believe_existed_IR6V_6xqWDU_360p.mp4", "bobthebombdotcom", "the worst Discription ever");

            videos.Add(v);
            videos.Add(v2);
            return(videos);
        }