Exemple #1
0
        public async Task <IActionResult> GetRelatedCountryByIdAsync(int buildingId)
        {
            CountryDto countryDto;

            try
            {
                var country = await _countryManager.GetByBuildingIdAsync(buildingId);

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

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

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