public static void UpdateTask(ServiceTask task, string note) { HttpClient client = new HttpClient(); Uri uri = new Uri("http://localhost:5000/api/tasks/" + task.ID.ToString() + "/" + task.Status); SetTaskStatusAsync(client, uri, task); if (note != "") { uri = new Uri("http://localhost:5000/api/tasks/" + task.ID.ToString() + "/notes"); AddNoteToTaskAsync(client, uri, note); } }
private static async void SetTaskStatusAsync(HttpClient client, Uri uri, ServiceTask task) { HttpResponseMessage result; var data = new HttpFormUrlEncodedContent( new Dictionary <string, string> { ["status"] = task.Status, ["id"] = task.ID.ToString() }); try { result = await client.PutAsync(uri, data); } catch (Exception e) { throw e; } }
public static void SetActiveTasks(ServiceTask task) { activeTask = task; }