Exemplo n.º 1
0
        public async Task <ActionResult> GetUserInfo(string userId)
        {
            try
            {
                requestCounter.SignalEventOccured();

                Uri  serviceName  = GetUserProfileServiceName(this.serviceContext);
                Uri  proxyAddress = GetProxyAddress(serviceName);
                long partitionKey = GetPartitionKey(userId);

                string proxyUrl = $"{proxyAddress}/api/user/{userId}?PartitionKey={partitionKey}&PartitionKind=Int64Range";

                using (HttpResponseMessage response = await this.httpClient.GetAsync(proxyUrl))
                {
                    if (response.StatusCode != System.Net.HttpStatusCode.OK)
                    {
                        return(new StatusCodeResult((int)response.StatusCode));
                    }

                    var resp = await response.Content.ReadAsStringAsync();

                    return(Ok(resp));
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }