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)); }
public async Task <int> DeleteRoleAsync(long roleId) { await ValidateId(_roleDao, roleId); if (await _userDao.IsAnyUserReferencingRoleAsync(roleId)) { var entityReferenceException = new EntityReferenceException(roleId, "Role is not deletable"); Logger.Error(entityReferenceException, "{Role} is not deletable", roleId); throw entityReferenceException; } return(await _roleDao.FluentSoftDeleteById(roleId)); }
public async Task <int> DeleteAddressAsync(long addressId) { await ValidateId(_addressDao, addressId); if (await _userDao.IsAnyUserReferencingAddressAsync(addressId)) { var entityReferenceException = new EntityReferenceException(addressId, "Address is not deletable"); Logger.Error(entityReferenceException, "{Address} is not deletable", addressId); throw entityReferenceException; } return(await _addressDao.FluentSoftDeleteById(addressId)); }