示例#1
0
文件: Class1.cs 项目: orinichevd/BVk
 public bool InsertTask(TaskStruct task)
 {
     try
     {
         using (var client = new HttpClient())
         {
             client.BaseAddress = new Uri(RequestUri.BaseUrl);
             var content = new FormUrlEncodedContent(new[]
             {
             new KeyValuePair<string, string>("targetId", task.innerTaskId.ToString()),
             new KeyValuePair<string, string>("ownerId", task.ownerId.ToString()),
             new KeyValuePair<string, string>("tags", string.Join(",",task.tags)),
             new KeyValuePair<string, string>("content", task.content)
         });
             var result = client.PostAsync(RequestUri.InsertTaskRequestUri, content).Result;
             string resultContent = result.Content.ReadAsStringAsync().Result;
             return true;
         }
     }
     catch
     {
         return false;
     }
 }
示例#2
0
文件: Class1.cs 项目: orinichevd/BVk
 public bool AlterTask(TaskStruct task)
 {
     try
     {
         using (var client = new HttpClient())
         {
             client.BaseAddress = new Uri(RequestUri.BaseUrl);
             var content = new FormUrlEncodedContent(new[]
             {
             new KeyValuePair<string, string>("innerTaskId", task.innerTaskId.ToString()),
             new KeyValuePair<string, string>("state", task.state ? "true" : "false"),
         });
             var result = client.PostAsync(RequestUri.AlterTaskRequestUri, content).Result;
             string resultContent = result.Content.ReadAsStringAsync().Result;
             return true;
         }
     }
     catch
     {
         return false;
     }
 }