Nfield.Services.Implementation.NfieldSurveysService.UpdateAsync C# (CSharp) Method

UpdateAsync() public method

See INfieldSurveysService.UpdateAsync
public UpdateAsync ( Nfield.Models.Survey survey ) : Task
survey Nfield.Models.Survey
return Task
        public Task<Survey> UpdateAsync(Survey survey)
        {
            if (survey == null)
            {
                throw new ArgumentNullException("survey");
            }

            var updatedSurvey = new UpdateSurvey
            {
                ClientName = survey.ClientName,
                Description = survey.Description,
                SurveyName = survey.SurveyName,
                InterviewerInstruction = survey.InterviewerInstruction
            };

            return Client.PatchAsJsonAsync(SurveysApi + survey.SurveyId, updatedSurvey)
             .ContinueWith(
                 responseMessageTask => responseMessageTask.Result.Content.ReadAsStringAsync().Result)
             .ContinueWith(
                 stringTask => JsonConvert.DeserializeObject<Survey>(stringTask.Result))
             .FlattenExceptions();
        }

Usage Example

 public void TestUpdateAsync_SurveyArgumentIsNull_ThrowsArgumentNullException()
 {
     var target = new NfieldSurveysService();
     Assert.Throws<ArgumentNullException>(() => UnwrapAggregateException(target.UpdateAsync(null)));
 }
All Usage Examples Of Nfield.Services.Implementation.NfieldSurveysService::UpdateAsync