示例#1
0
        public async Task <DeliveryOptionVM> DeliveryOption(Delivery_optionsDTO model)
        {
            string url     = siteSettings.PordoUrl;
            var    client  = _clientFactory.CreateClient();
            var    request = new HttpRequestMessage(HttpMethod.Post, url + $"/delivery-options");

            StringContent content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(model), Encoding.UTF8, "application/json");

            request.Content = content;

            request.Headers.Add("Authorization", "Bearer " + Token);

            var response = await client.SendAsync(request);

            //if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized)
            //    return Unauthorized();

            var api = Newtonsoft.Json.JsonConvert.DeserializeObject <DeliveryOptionVM>(await response.Content.ReadAsStringAsync());


            return(api);
        }
示例#2
0
        public virtual async Task <ApiResult <DeliveryOptionVM> > GetCost(Delivery_optionsDTO model, CancellationToken cancellationToken)
        {
            var padroDeliveryOption = await _padroService.DeliveryOption(model);

            return(padroDeliveryOption);
        }