Esempio n. 1
0
        public async Task <IActionResult> GetRelatedBuildingByIdAsync(int orderId)
        {
            BuildingDto buildingDto;

            try
            {
                var building = await _buildingManager.GetByOrderIdAsync(orderId);

                buildingDto = _mapper.Map <BuildingDto>(building);
            }
            catch (EntityNotFoundException)
            {
                buildingDto = null;
            }

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

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