Пример #1
0
        public async Task <IActionResult> GetRnadomJoke(string category)
        {
            try
            {
                var result = await _jokesServices.GetRandomJoke(category);

                if (!string.IsNullOrEmpty(result.value))
                {
                    return(Ok(result));
                }
                else
                {
                    return(NotFound());
                }
            }
            catch (Exception)
            {
                throw new Exception("An error has occured while attempting to fetch the data");
            }
        }
Пример #2
0
 public async Task <IActionResult> GetRandomJoke()
 {
     return(await _iJokesService.GetRandomJoke());
 }