public void DeleteOneVideo() { Video videoDelete = new Video { Id = 3, Name = "Deporte", Author = "Pepe", Hour = 0, MinSeconds = 3.1, LinkVideo = "www.youtube.com/deportePepe" }; listVideo.Add(videoDelete); var options = new DbContextOptionsBuilder <BetterCalmContext>() .UseInMemoryDatabase(databaseName: "MSP.BetterCalmDatabase").Options; var context = new BetterCalmContext(options); listVideo.ForEach(video => context.Add(video)); context.SaveChanges(); repository = new VideoRepository(context); repository.Delete(videoDelete); context.Database.EnsureDeleted(); Video getVideo = repository.Get(3); Assert.AreEqual(null, getVideo); }
public static void UpdateChannel(string channelId) { var playlistId = YouTubeApi.GetUploadsPlaylistId(channelId); var newItems = YouTubeApi.PlaylistItemsByPlaylistId(playlistId) .Except(videos.Get().Select(v => v.VideoId)); foreach (var newItem in newItems) { videos.Add(newItem); } }
public void GetOneVideo() { var options = new DbContextOptionsBuilder <BetterCalmContext>() .UseInMemoryDatabase(databaseName: "MSP.BetterCalmDatabase").Options; var context = new BetterCalmContext(options); listVideo.ForEach(cat => context.Add(cat)); context.SaveChanges(); repository = new VideoRepository(context); var video = repository.Get(listVideo[0].Id); context.Database.EnsureDeleted(); Assert.AreEqual(listVideo[0].Id, video.Id); }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request.QueryString["i"])) { // Sanitize the video ID string requestedID = Sanitizers.SanitizeQueryStringID(Request.QueryString["i"]); VideoRepository videoRepository = new VideoRepository(); Video video = videoRepository.Get(requestedID); if (video != null) { // Determine if the viewer is viewing from inside the network string clientIP = Request.ServerVariables["REMOTE_ADDR"]; bool canUserAccessPrivateContent = Config.CanAccessPrivate(clientIP); if ( (video.IsPrivate && canUserAccessPrivateContent) || (!video.IsPrivate) ) { // Set the page title string originalTitle = Page.Header.Title; Page.Header.Title = video.Name + " - " + originalTitle; // Determine which player to display the video in if (video.IsYoutubeAvailable) { litPlayer.Text = YoutubeVideoPlayer.GetHTML(video); } else { litPlayer.Text = HTML5VideoPlayer.GetHTML(video); } tblContainer.Visible = true; litVideoInfo.Text = videoInfoSection(video); } else { displayError("This video is marked as private. you can only watch from within the LSKYSD network."); } } else { displayError("A video with that ID was not found."); } } }
protected void btnDelete_OnClick(object sender, EventArgs e) { string videoID = lblID.Text.Trim(); VideoRepository videoRepository = new VideoRepository(); Video video = videoRepository.Get(videoID); if (video != null) { try { videoRepository.Delete(video); RedirectToVideoList(string.Empty); } catch (Exception ex) { displayError(ex.Message); } } }
protected void btnEdit_OnClick(object sender, EventArgs e) { string videoID = lblID.Text.Trim(); VideoRepository videoRepository = new VideoRepository(); Video video = videoRepository.Get(videoID); if (video != null) { try { Video editedVideo = parseVideo(); videoRepository.Update(editedVideo); } catch (Exception ex) { displayError(ex.Message); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Get the video ID and attempt to load it if (!string.IsNullOrEmpty(Request.QueryString["i"])) { string streamID = Request.QueryString["i"].ToString(); VideoRepository videoRepository = new VideoRepository(); Video video = videoRepository.Get(streamID); if (video != null) { displayVideo(video); } else { displayError("A stream with that ID was not found."); } } } }
public static void UpdateVideoViewCounts() { videos.Get().Select(v => v.VideoId).ToList().ForEach(ScheduleUpdateVideoViewCount); }
public static void ScheduleVideoUpdates() { videos.Get().ToList().ForEach(ScheduleVideoUpdate); }
public IEnumerable <string> Get() { return(videos.Get().Select(v => v.VideoId)); }
public HttpResponseMessage GetVideoById(int id) { return(Request.CreateResponse(HttpStatusCode.OK, video.Get(id))); }