/// <summary> /// Obtains the service configuration records for the specified domain. /// </summary> /// <param name="domain">Name of the domain</param> /// <returns>A collection of service configuration records for the specified domain in JSON.</returns> public async Task <PartialViewResult> ConfigurationRecords(string customerId, string domain) { ConfigurationRecordsModel configurationRecords; GraphClient client; List <DomainDnsRecord> records; try { client = new GraphClient(Provider, customerId); configurationRecords = new ConfigurationRecordsModel(); records = await client.GetDomainConfigurationRecordsAsync(domain).ConfigureAwait(false); configurationRecords.ServiceConfigurationRecords.AddRange(records); return(PartialView(configurationRecords)); } finally { client = null; records = null; } }
public async Task <PartialViewResult> ConfigurationRecords(string customerId, string domain) { AuthenticationResult token; ConfigurationRecordsModel domainDetailsModel; GraphClient client; if (string.IsNullOrEmpty(customerId)) { throw new ArgumentNullException(nameof(customerId)); } if (string.IsNullOrEmpty(domain)) { throw new ArgumentNullException(nameof(domain)); } try { token = await TokenContext.GetAADTokenAsync( $"{AppConfig.Authority}/{customerId}", AppConfig.GraphUri ); client = new GraphClient(token.AccessToken); domainDetailsModel = new ConfigurationRecordsModel() { ServiceConfigurationRecords = await client.GetServiceConfigurationRecordsAsync(customerId, domain) }; return(PartialView(domainDetailsModel)); } finally { client = null; token = null; } }