Ejemplo n.º 1
0
        public async Task<ActionResult> Index()
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("http://localhost:25165/");
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                // HTTP POST
                var gizmo = new PayInfo() { OrderNo = "12345678", TotalAmount = 6 };
                var response = await client.PostAsJsonAsync("api/test/test", gizmo);
                var resultValue = await response.Content.ReadAsAsync<BizResult<PayInfo>>();
                if (response.IsSuccessStatusCode)
                {
                    Uri gizmoUrl = response.Headers.Location;
                }
            }

            return View();
        }
Ejemplo n.º 2
0
 public BizResult<PayInfo> Test(PayInfo payInfo)
 {
     BizResult<PayInfo> biz = new BizResult<PayInfo>() { ReturnObject = new PayInfo() { OrderNo = "abcdedfg", TotalAmount = 100 } };
     return biz;
 }