private CosmosService GetCosmosService() { return(new CosmosService( _apiConfiguration.CosmosDbEndpoint, _apiConfiguration.CosmosDbKey, SessionFilterAttribute.GetSessionId(HttpContext))); }
public async Task <StatusPayload> Index() { var cosmosService = new CosmosService( _apiConfiguration.CosmosDbEndpoint, _apiConfiguration.CosmosDbKey, SessionFilterAttribute.GetSessionId(HttpContext)); // Ask both in parallel var statusTask = cosmosService.GetStatusAsync(); var photoCountTask = cosmosService.GetImageCountAsync(); await Task.WhenAll(statusTask, photoCountTask); return(new StatusPayload { Status = statusTask.Result, ImageCount = photoCountTask.Result }); }