public async Task<string> UpdateAsync(ToDoItem item) { using (var client = CloudantClient()) { var response = await client.PutAsJsonAsync(_dbName + "/" + item.id + "?rev=" + item.rev, item); if (response.IsSuccessStatusCode) { var responseJson = await response.Content.ReadAsAsync<ToDoItem>(); return JsonConvert.SerializeObject(new { id = responseJson.id, rev = responseJson.rev }); } string msg = "Failure to PUT. Status Code: " + response.StatusCode + ". Reason: " + response.ReasonPhrase; Console.WriteLine(msg); return JsonConvert.SerializeObject(new { msg = msg }); } }
public async Task<dynamic> Delete(ToDoItem item) { return await _cloudantService.DeleteAsync(item); }
public async Task<string> Update(ToDoItem item) { return await _cloudantService.UpdateAsync(item); }