public async Task <JsonResult> List(string customerId) { AuthenticationResult token; GraphClient client; List <Domain> domains; if (string.IsNullOrEmpty(customerId)) { throw new ArgumentNullException(nameof(customerId)); } try { token = await TokenContext.GetAADTokenAsync( $"{AppConfig.Authority}/{customerId}", AppConfig.GraphUri ); client = new GraphClient(token.AccessToken); domains = await client.GetDomainsAsync(customerId); return(Json(domains, JsonRequestBehavior.AllowGet)); } finally { client = null; domains = null; token = null; } }
public async Task <JsonResult> List(string customerId) { GraphClient client; List <DomainModel> domains; customerId.AssertNotEmpty(nameof(customerId)); try { client = new GraphClient(Provider, customerId); domains = await client.GetDomainsAsync().ConfigureAwait(false); return(Json(domains, JsonRequestBehavior.AllowGet)); } finally { client = null; domains = null; } }
public async Task <JsonResult> List(string customerId) { GraphClient client; List <DomainModel> domains; customerId.AssertNotEmpty(nameof(customerId)); try { client = new GraphClient(this.Service, customerId); domains = await client.GetDomainsAsync(); return(this.Json(domains, JsonRequestBehavior.AllowGet)); } finally { client = null; domains = null; } }