Exemple #1
0
        public virtual void Create(Dictionary <string, object> tokens, string subEndpoint = null, string filepath = null)
        {
            string endpoint = RecordEndpoint;

            if (subEndpoint != null)
            {
                endpoint += subEndpoint;
            }

            if (filepath == null)
            {
                string body = JsonConvert.SerializeObject(tokens);
                var    task = RecordClient.HttpPostAsync(endpoint, body);
                task.Wait();

                UpdateRecord(task.Result);
            }
            else
            {
                Dictionary <string, string> postFields = new Dictionary <string, string> ();
                foreach (KeyValuePair <string, object> entry in tokens)
                {
                    postFields.Add(entry.Key, entry.Value.ToString());
                }

                var task = RecordClient.HttpPostFormAsync(endpoint, filepath, postFields);
                task.Wait();

                UpdateRecord(task.Result);
            }
        }
Exemple #2
0
        public virtual void Create(Dictionary <string, object> tokens, string endponit)
        {
            string body = JsonConvert.SerializeObject(tokens);
            var    task = RecordClient.HttpPostAsync(RecordEndpoint + endponit, body);

            task.Wait();

            UpdateRecord(task.Result);
        }