예제 #1
0
        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;
        }
예제 #2
0
        public void Insert(Order order)
        {
            var client = new HttpClient();

            var postData = new List<KeyValuePair<string, string>>()
            {
                new KeyValuePair<string, string>("ProductName", order.ProductName),
                new KeyValuePair<string, string>("Type", order.Type),
                new KeyValuePair<string, string>("Price", order.Price.ToString()),
                new KeyValuePair<string, string>("ProductName", order.ProductName)
            };

            var formContent = new FormUrlEncodedContent(postData);

            client.PostAsync("http://api.cash.io/Order", formContent);
        }