예제 #1
0
 private CosmosService GetCosmosService()
 {
     return(new CosmosService(
                _apiConfiguration.CosmosDbEndpoint,
                _apiConfiguration.CosmosDbKey,
                SessionFilterAttribute.GetSessionId(HttpContext)));
 }
예제 #2
0
        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
            });
        }