/// <summary> /// <see cref="INfieldSurveyResponseCodesService.UpdateAsync"/> /// </summary> public Task <SurveyResponseCode> UpdateAsync(string surveyId, SurveyResponseCode responseCode) { if (string.IsNullOrEmpty(surveyId)) { throw new ArgumentNullException("surveyId"); } if (responseCode == null) { throw new ArgumentNullException("responseCode"); } var updatedresponseCode = new UpdateSurveyResponseCode { Description = responseCode.Description, IsDefinite = responseCode.IsDefinite, IsSelectable = responseCode.IsSelectable, AllowAppointment = responseCode.AllowAppointment }; return (Client.PatchAsJsonAsync(SurveyResponseCodeUrl(surveyId, responseCode.ResponseCode), updatedresponseCode) .ContinueWith( responseMessageTask => responseMessageTask.Result.Content.ReadAsStringAsync().Result) .ContinueWith( stringTask => JsonConvert.DeserializeObjectAsync <SurveyResponseCode>(stringTask.Result).Result) .FlattenExceptions()); }
/// <summary> /// <see cref="INfieldSurveyResponseCodesService.UpdateAsync"/> /// </summary> public Task<SurveyResponseCode> UpdateAsync(string surveyId, SurveyResponseCode responseCode) { if (string.IsNullOrEmpty(surveyId)) { throw new ArgumentNullException("surveyId"); } if(responseCode == null) { throw new ArgumentNullException("responseCode"); } var updatedresponseCode = new UpdateSurveyResponseCode { Description = responseCode.Description, IsDefinite = responseCode.IsDefinite, IsSelectable = responseCode.IsSelectable, AllowAppointment = responseCode.AllowAppointment }; return Client.PatchAsJsonAsync(SurveyResponseCodeUrl(surveyId, responseCode.ResponseCode), updatedresponseCode) .ContinueWith( responseMessageTask => responseMessageTask.Result.Content.ReadAsStringAsync().Result) .ContinueWith( stringTask => JsonConvert.DeserializeObjectAsync<SurveyResponseCode>(stringTask.Result).Result) .FlattenExceptions(); }