Esempio n. 1
0
        public async Task <SurveyCommentModel> CreateSurveyComment(SurveyCommentModel surveyCommentModel, string authenticationToken)
        {
            try
            {
                CommentService commentService = new CommentService();

                var response = await commentService.CreateSurveyComment(surveyCommentModel, authenticationToken);

                if (response.IsSuccessStatusCode)
                {
                    var json = await response.Content.ReadAsStringAsync();

                    return(JsonConvert.DeserializeObject <SurveyCommentModel>(json));
                }
                else
                {
                    throw new Exception(response.StatusCode.ToString() + " - " + response.ReasonPhrase);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }