示例#1
0
        public void Insert(Order order)
        {
            // directly depend on some web service
            var client = new HttpClient();
            var response = client.PostAsync<Order>("http://api.joey.io/Order", order, new JsonMediaTypeFormatter()).Result;

            response.EnsureSuccessStatusCode();
        }
 public void Insert(Order order)
 {
     // directly depend on some web service
     var client = new HttpClient();
     client.PostAsync<Order>("http://api.joey.io/Order", order, new JsonMediaTypeFormatter());
 }
        private Order Mapping(string[] line)
        {
            var result = new Order
            {
                ProductName = line[0],
                Type = line[1],
                Price = Convert.ToInt32(line[2]),
                CustomerName = line[3]
            };

            return result;
        }