public async Task <Media> MediaSearchAsync(string query) { var searchContainer = await tmdbClient.SearchMultiAsync(query); if (!searchContainer.Results.Any()) { throw new KeyNotFoundException($"No results for '{query}'"); } var result = searchContainer.Results.First(); switch (searchContainer.Results.First().MediaType) { case (MediaType.Movie): return(await movieRepository.GetAsync(result.Id)); case (MediaType.Tv): return(await tvRepository.GetAsync(result.Id)); default: throw new KeyNotFoundException($"Unsupported media type ({result.MediaType}) for '{query}'"); } }
public async Task <TVShow> GetAsync(int id) { return(await tvRepository.GetAsync(id)); }