public async void EditRant(int rantId, PostContent post) { string url = string.Concat(Constants.BaseAddress, Constants.PathRants, rantId); MultipartFormDataContent data = CreateAuthenticatedMultipart(); data.Add(new StringContent(post.Text), "rant"); if (post.Image != null) { data.Add(new ByteArrayContent(post.Image), "image", post.GenerateImageName()); } if (!string.IsNullOrEmpty(post.Tag)) { data.Add(new StringContent(post.Tag), "tags"); } var response = await client.PostAsync(url, data); var responseText = await response.Content.ReadAsStringAsync(); JObject obj = JObject.Parse(responseText); if (owner.CheckSuccess(obj)) { } }
public async Task PostComment(long rantId, PostContent post) { string url = string.Concat(Constants.BaseAddress, Constants.PathRants, rantId, "/comments"); MultipartFormDataContent data = CreateAuthenticatedMultipart(); data.Add(new StringContent(post.Text), "comment"); if (post.Image != null) { data.Add(new ByteArrayContent(post.Image), "image", post.GenerateImageName()); } var response = await client.PostAsync(url, data); var responseText = await response.Content.ReadAsStringAsync(); JObject obj = JObject.Parse(responseText); owner.CheckSuccess(obj); }