コード例 #1
0
        internal async Task <bool> EditAnswersAsync(Modell.ChallengeObjects.Answers param)
        {
            string json = await Task.Run(() => JsonConvert.SerializeObject(param));

            HttpContent         content = new StringContent(json, Encoding.UTF8, "application/json");
            HttpResponseMessage result  = await _httpClient.PutAsync(new Uri(answersBaseUri, param.AnswersID.ToString()), content);

            return(result.IsSuccessStatusCode);
        }
コード例 #2
0
        public async Task <Modell.ChallengeObjects.Answers> CreateAnswersAsync(Modell.ChallengeObjects.Answers param)
        {
            string json = await Task.Run(() => JsonConvert.SerializeObject(param));

            HttpContent         content = new StringContent(json, Encoding.UTF8, "application/json");
            HttpResponseMessage result  = await _httpClient.PostAsync(answersBaseUri, content);

            param.AnswersID = int.Parse(result.Headers.Location.Segments.Last());

            return(param);
        }