/// <summary> /// DELETE /tables/TodoItem/{id} /// </summary> public static void DeleteTodo(Task t) { WebClient client = new WebClient(); try { // make it synchronous client.Headers.Add (HttpRequestHeader.Accept, "application/json"); client.Headers.Add (HttpRequestHeader.ContentType, "application/json"); client.Headers.Add ("X-ZUMO-APPLICATION", MobileServiceAppId); var payload = t.ToJson (); var response = client.UploadString (String.Format (DeleteUrl,t.Id), "DELETE", payload); // DELETE // ...and wait... var responseString = response; //var responseJson = JsonValue.Parse (responseString); //HACK: Console.WriteLine ("Delete Json response => " + responseString); } catch (System.Net.WebException e) { Console.WriteLine ("X-ZUMO-APPLICATION add failed" + e.Message); } }
/// <summary> /// DELETE /tables/TodoItem/{id} /// </summary> public static void DeleteTodo(Task t) { WebClient client = new WebClient(); try { // make it synchronous client.Headers.Add(HttpRequestHeader.Accept, "application/json"); client.Headers.Add(HttpRequestHeader.ContentType, "application/json"); client.Headers.Add("X-ZUMO-APPLICATION", MobileServiceAppId); var payload = t.ToJson(); var response = client.UploadString(String.Format(DeleteUrl, t.Id), "DELETE", payload); // DELETE // ...and wait... var responseString = response; //var responseJson = JsonValue.Parse (responseString); //HACK: Console.WriteLine("Delete Json response => " + responseString); } catch (System.Net.WebException e) { Console.WriteLine("X-ZUMO-APPLICATION add failed" + e.Message); } }
/// <summary> /// POST /tables/TodoItem /// {"text":"new task text","complete":false} /// </summary> public static Task AddTodo(Task t) { WebClient client = new WebClient(); try { // make it synchronous client.Headers.Add (HttpRequestHeader.Accept, "application/json"); client.Headers.Add (HttpRequestHeader.ContentType, "application/json"); client.Headers.Add ("X-ZUMO-APPLICATION", MobileServiceAppId); var payload = t.ToJson (); var response = client.UploadString (AddUrl, "POST", payload); // PATCH // ...and wait... var responseString = response; // RETURNS [{"id":1,"text":"Port to iOS and Android","complete":false}] Console.WriteLine ("Add Json response => " + responseString); var responseJson = JsonValue.Parse (responseString); return new Task(responseJson); } catch (System.Net.WebException e) { Console.WriteLine ("X-ZUMO-APPLICATION add failed" + e.Message); } return null; }
/// <summary> /// POST /tables/TodoItem /// /// </summary> public static void AddTodo(Task t) { WebClient client = new WebClient(); try { // HACK: Android issue - see Validator method declaration ServicePointManager.ServerCertificateValidationCallback = Workaround.Validator; // make it synchronous client.Headers.Add(HttpRequestHeader.Accept, "application/json"); client.Headers.Add(HttpRequestHeader.ContentType, "application/json"); client.Headers.Add("X-ZUMO-APPLICATION", MobileServiceAppId); var payload = t.ToJson(); var response = client.UploadString(AddUrl, "POST", payload); // PATCH // ...and wait... var responseString = response; //var responseJson = JsonValue.Parse (responseString); //HACK: Console.WriteLine("Add Json response => " + responseString); } catch (System.Net.WebException e) { Console.WriteLine("X-ZUMO-APPLICATION add failed" + e.Message); } }
/// <summary> /// POST /tables/TodoItem /// /// </summary> public static void AddTodo(Task t) { WebClient client = new WebClient(); try { // HACK: Android issue - see Validator method declaration ServicePointManager.ServerCertificateValidationCallback = Workaround.Validator; // make it synchronous client.Headers.Add (HttpRequestHeader.Accept, "application/json"); client.Headers.Add (HttpRequestHeader.ContentType, "application/json"); client.Headers.Add ("X-ZUMO-APPLICATION", MobileServiceAppId); var payload = t.ToJson (); var response = client.UploadString (AddUrl, "POST", payload); // PATCH // ...and wait... var responseString = response; //var responseJson = JsonValue.Parse (responseString); //HACK: Console.WriteLine ("Add Json response => " + responseString); } catch (System.Net.WebException e) { Console.WriteLine ("X-ZUMO-APPLICATION add failed" + e.Message); } }
/// <summary> /// POST /tables/TodoItem /// {"text":"new task text","complete":false} /// </summary> public static Task AddTodo(Task t) { WebClient client = new WebClient(); try { // make it synchronous client.Headers.Add(HttpRequestHeader.Accept, "application/json"); client.Headers.Add(HttpRequestHeader.ContentType, "application/json"); client.Headers.Add("X-ZUMO-APPLICATION", MobileServiceAppId); var payload = t.ToJson(); var response = client.UploadString(AddUrl, "POST", payload); // PATCH // ...and wait... var responseString = response; // RETURNS [{"id":1,"text":"Port to iOS and Android","complete":false}] Console.WriteLine("Add Json response => " + responseString); var responseJson = JsonValue.Parse(responseString); return(new Task(responseJson)); } catch (System.Net.WebException e) { Console.WriteLine("X-ZUMO-APPLICATION add failed" + e.Message); } return(null); }