Esempio n. 1
0
        public async Task <int> DeleteCityAsync(long cityId)
        {
            await ValidateId(_cityDao, cityId);

            if (await _addressDao.IsAnyAddressReferencingCityAsync(cityId))
            {
                var entityReferenceException = new EntityReferenceException(cityId, "City is not deletable");
                Logger.Error(entityReferenceException, "{City} is not deletable", cityId);
                throw entityReferenceException;
            }

            return(await _cityDao.FluentSoftDeleteById(cityId));
        }