Beispiel #1
0
 public bool Put(string id, AnswerMCModel answerMC)
 {
     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(answerMC);
         client.Execute(request);
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Beispiel #2
0
 public AnswerMCModel 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 <AnswerMCModel> response = client.Execute <AnswerMCModel>(request);
         AnswerMCModel answerMC = response.Data;
         return(answerMC);
     }
     catch (Exception e)
     {
         return(null);
     }
 }