public async Task <IActionResult> List() { try { var countries = await _repository.FindAllAsync(); if (countries == null) { return(Ok(_errorHandler.JsonErrorMessage((int)HttpStatusCode.NotFound))); } var countryDTO = _mapper.Map <IEnumerable <CountryDTO> >(countries); return(Ok(countryDTO)); } catch (Exception ex) { return(BadRequest(_errorHandler.JsonErrorMessage((int)HttpStatusCode.BadRequest, ex.Message))); } }