示例#1
0
        public async Task <IActionResult> GetRelatedCountryByIdAsync(string telephoneId)
        {
            CountryDto countryDto;

            try
            {
                var country = await _countryManager.GetByTelephoneIdAsync(telephoneId);

                countryDto = _mapper.Map <CountryDto>(country);
            }
            catch (EntityNotFoundException)
            {
                countryDto = null;
            }

            var links = _jsonApiBuilder.BuildSingleResourceLinks(HttpContext.Request.Path);

            return(Ok(new ResourceResponse()
            {
                Links = links, Data = countryDto
            }));
        }