Exemplo n.º 1
0
        public static async Task InsertQuestion(SurveyFy.API.Models.Question question)
        {
            HttpClient          client   = new HttpClient();
            HttpResponseMessage response = await client.PostAsJsonAsync("http://api.surveyfy.co.uk/api/questions", question);

            response.EnsureSuccessStatusCode();
        }
Exemplo n.º 2
0
        public static async Task <SurveyFy.API.Models.Question> GetQuestion(int id)
        {
            HttpClient client = new HttpClient();

            SurveyFy.API.Models.Question question = new SurveyFy.API.Models.Question();
            HttpResponseMessage          response = await client.GetAsync("http://api.surveyfy.co.uk/api/questions/" + id.ToString());

            if (response.IsSuccessStatusCode)
            {
                question = await response.Content.ReadAsAsync <SurveyFy.API.Models.Question>();
            }

            return(question);
        }