ConsoleApp1/Services/ChuckNorrisService.cs
/// <summary>
/// Get random joke from Web API call
/// </summary>
/// <param name="parameters"></param>
/// <returns></returns>
Get random joke from Web API call
Get random joke from Web API call
public async Task<String> GetRandomJokeAsync(IDictionary<string, string> parameters = null)
        {
            try
            {
                string url = RandomJokeUrl.AddQueryString(parameters);
                var joke = await Client.GetFromJsonAsync<Joke>(url);
                return joke.Value;
            }
            catch (Exception ex)
            {
                throw new ChuckNorrisServiceException(ChuckNorrisServiceException.JOKES_GET_ERROR, ex);
            }
        }
public async Task < String > GetRandomJokeAsync ( IDictionary < string , string > parameters = null ) { try { string url = RandomJokeUrl . AddQueryString ( parameters ) ; var joke = await Client . GetFromJsonAsync < Joke > ( url ) ; return joke . Value ; } catch ( Exception ex ) { throw new ChuckNorrisServiceException ( ChuckNorrisServiceException . JOKES_GET_ERROR , ex ) ; } }
Get random joke from Web API call
Get random joke from Web API call
None
parameters
IDictionary<string, string>
None