public virtual bool ZoneExists(string baseDomain, ZoneSearchType searchType) { try { return(GetZone(baseDomain, searchType) != null); } catch { return(false); } }
public virtual DnsZone GetZone(string searchFor, ZoneSearchType searchType) { switch (searchType) { case ZoneSearchType.Id: return(GetZones().FirstOrDefault(x => x.Id == searchFor)); case ZoneSearchType.Name: return(GetZones().FirstOrDefault(x => x.Name == searchFor)); default: throw new ArgumentOutOfRangeException(nameof(searchType), searchType, null); } }
public static DnsProvider GetDnsProviderFromBaseDomain(string baseDomain, ZoneSearchType zoneSearchType) { var dnsProviders = DnsProviderType.GetDnsProviders(); return(dnsProviders.FirstOrDefault(dnsProvider => dnsProvider.ZoneExists(baseDomain, zoneSearchType))); }