public override async Task <string> RetornarDesafio(int idFilme) { try { Model.Movie filme = await RetornarFilme(idFilme); return(filme.Title + " / " + new string(filme.Title.Reverse().ToArray())); } catch (Exception ex) { return(ex.Message); } }
public async Task <Model.Movie> RetornarFilme(int id) { Model.Movie filme = new Model.Movie(); string url = _config.BaseUrl + "movie/" + id + $"?api_key={_config.ApiKey}&language={_config.Language}"; using (HttpResponseMessage response = await _apiClient.GetAsync(url)) { if (response.IsSuccessStatusCode) { return(await response.Content.ReadAsAsync <Model.Movie>()); } else { throw new Exception(response.ReasonPhrase); } } }