Пример #1
0
        public async Task <IActionResult> GetSuburb(int id)
        {
            var suburb = await repository.GetSuburb(id);

            if (suburb == null)
            {
                return(NotFound());
            }
            var suburbResource = mapper.Map <Suburb, SuburbResource>(suburb);

            return(Ok(suburbResource));
        }
        private async Task <Property> PopulateRelatedFields(Property property, PropertyResource propertyResource)
        {
            property.Owner = await ownerRepository.GetOwner((int)propertyResource.OwnerId);

            property.Suburb = await suburbRepository.GetSuburb(propertyResource.SuburbId);

            property.PropertyType = await propertyTypeRepository.GetPropertyType(propertyResource.PropertyTypeId);

            return(property);
        }