public virtual void Update(Dictionary <string, object> tokens, string subEndpoint = null, string filepath = null) { string endpoint = RecordEndpoint + "/" + this["id"].ToString(); if (subEndpoint != null) { endpoint += subEndpoint; } if (filepath == null) { string body = JsonConvert.SerializeObject(tokens); var task = RecordClient.HttpPatchAsync(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.HttpPatchFormAsync(endpoint, filepath, postFields); task.Wait(); UpdateRecord(task.Result); } }
public virtual void Read(string endpoint, Dictionary <string, string> query) { var task = RecordClient.HttpGetAsync(RecordEndpoint + endpoint, query); task.Wait(); UpdateList(task.Result); }
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); }
public virtual void Delete() { string endpoint = RecordEndpoint + "/" + this["id"].ToString(); var task = RecordClient.HttpDeleteAsync(endpoint); task.Wait(); UpdateRecord(empty_record); }
public virtual void Read(long id) { string endpoint = RecordEndpoint + "/" + id.ToString(); var task = RecordClient.HttpGetAsync(endpoint, new Dictionary <string, string>()); task.Wait(); UpdateRecord(task.Result); }
public virtual void Update() { string endpoint = RecordEndpoint + "/" + this["id"].ToString(); string body = JsonConvert.SerializeObject(cache); var task = RecordClient.HttpPatchAsync(endpoint, body); task.Wait(); UpdateRecord(task.Result); }