Ejemplo n.º 1
0
        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));
        }