public void GetVideoEmbedUrl_ProvidedVariousVideoKinds_GetCorrectVideoFormat(VideoKindEnum kind, string embedUrlPrefix) { var model = new VideoWidgetViewModel("foo", "123456", kind); string actualEmbedUrl = VideoHelper.GetVideoEmbedUrl(model); Assert.That(actualEmbedUrl, Does.StartWith(embedUrlPrefix)); }
public PartialViewResult Sidebars() { //MVC 5 does not support asynchronous in partial view. Fetch the data synchronously ViewBag.ApprovedVideos = VideoWidgetViewModel.Create(_uow, 1, 10, "approved", string.Empty); ViewBag.HasPlayedVideos = VideoWidgetViewModel.Create(_uow, 1, 10, "hasplayed", string.Empty); return(PartialView("_Sidebars")); }
// GET: VideoWidget public ActionResult Index() { var properties = GetProperties(); var viewModel = new VideoWidgetViewModel { VideoUrl = properties.VideoUrl, }; return(PartialView("~/Views/Shared/Kentico/Widgets/_VideoWidget.cshtml", viewModel)); }
public IActionResult DeleteVideoLink(VideoWidgetViewModel model) { if (model.Id != null) { _videoService.DeleteModel(model.Id); return(Ok()); } return(BadRequest()); }
public async Task <IViewComponentResult> InvokeAsync(VideoWidgetViewModel model) { var modelText = JsonConvert.SerializeObject(model, new JsonSerializerSettings { Formatting = Formatting.Indented }); ViewData["modelText"] = modelText; return(View(model)); }
public async Task <IViewComponentResult> InvokeAsync(VideoWidgetViewModel model) { ViewBag.VideoSourceTypes = GetVideoSourceTypesAsSelectList(); if (isLiveVideoEnabled()) { ViewBag.LiveVideoList = await GetVideoStreamLinksAsSelectListAsync(); } //ViewBag.OnDemandVideoList = await GetFileDocumentsAsSelectListAsync(); return(View(model)); }
public IActionResult UpdateVideoLink(VideoWidgetViewModel model) { if (ModelState.IsValid) { // If the full URL is entered, then extract just the video id. if (model.VideoSourceType == VideoSourceTypes.YouTube) { model.YouTubeVideoId = ExtractYouTubeIdFromUrl(model.YouTubeVideoId); } _videoService.UpdateModel(model); return(Ok(model)); } return(BadRequest(ModelState)); }
public void GetVideoEmbedUrl_VideoIsNotSupported_ThrowsNotSupportedException() { var model = new VideoWidgetViewModel("foo", "bar", VideoKindEnum.Unknown); Assert.Throws<NotSupportedException>(() => VideoHelper.GetVideoEmbedUrl(model)); }