示例#1
0
        private async Task <bool> ValidateToken(string token)
        {
            var encodedToken = System.Web.HttpUtility.UrlEncode(token);
            var authUri      = $"{_configuration["AuthorizationServiceEndpoint"]}Login/ValidateToken?token={encodedToken}";
            var IsValid      = await HttpRequestClient.GetRequest <bool>(authUri);

            return(IsValid);
        }
        public async Task <IActionResult> GetOrders(int customerId)
        {
            string          GetCustomerUri  = $"{Configuration["CusotmerServiceEndpoint"]}/Customers/Get/{customerId}";
            CustomerDetails customerDetails = await HttpRequestClient.GetRequest <CustomerDetails>(GetCustomerUri);

            string GetOrderUri = $"{Configuration["OrderServiceEndpoint"]}/Orders/GetByCustomer/{customerId}";
            List <OrderDetails> orderDetails = await HttpRequestClient.GetRequest <List <OrderDetails> >(GetOrderUri);

            if (orderDetails == null)
            {
                orderDetails = new List <OrderDetails>();
            }

            customerDetails.OrderDetails = orderDetails;
            return(Ok(customerDetails));
        }
示例#3
0
 private async Task <string> GetEmailTemplate(string emailTemplateUri)
 {
     return(await _httpRequestClient.GetRequest(emailTemplateUri));
 }