public async Task DeleteAsync(Guid id) { var host = await _hostRepository.GetAsync(id); if (host is null) { throw new HostNotFoundException(id); } await _hostRepository.DeleteAsync(host); }
public async Task DeleteAsync(Guid id) { var host = await _hostRepository.GetAsync(id); if (host is null) { throw new HostNotFoundException(id); } if (await _hostDeletionPolicy.CanDeleteAsync(host) is false) { throw new CannotDeleteHostException(id); } await _hostRepository.DeleteAsync(host); }