public async Task <IActionResult> SaveVideo([FromBody] VideosDto video) { try { await repository.SaveVideo(mapper.Map <Videos>(video)); return(Ok()); } catch (Exception) { return(BadRequest(new { Message = "Error processing your request." })); } }
public List <VideosDto> GetVideos(int tmdbId) { ResultContainer <Video> tmdbVideos = _client.GetMovieVideosAsync(tmdbId).Result; List <VideosDto> videos = new List <VideosDto>(); string urlPrefix = "https://www.youtube.com/embed/"; foreach (var video in tmdbVideos.Results) { if (video.Site == "YouTube") { VideosDto newVideo = new VideosDto() { Key = $"{urlPrefix}{video.Key}" }; videos.Add(newVideo); } } return(videos); }