예제 #1
0
 public bool Put(string id, AnswerTFModel answerTF)
 {
     try
     {
         var client  = new RestClient();
         var request = new RestRequest(url + id, Method.PUT);
         request.RequestFormat = DataFormat.Json;
         request.AddHeader("Content-Type", "application/json");
         request.AddJsonBody(answerTF);
         client.Execute(request);
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
예제 #2
0
 public AnswerTFModel GetById(string id)
 {
     try
     {
         var client  = new RestClient();
         var request = new RestRequest(url + id, Method.GET);
         request.RequestFormat = DataFormat.Json;
         request.AddHeader("Content-Type", "application/json");
         IRestResponse <AnswerTFModel> response = client.Execute <AnswerTFModel>(request);
         AnswerTFModel answerTF = response.Data;
         return(answerTF);
     }
     catch (Exception e)
     {
         return(null);
     }
 }