Exemplo n.º 1
0
 public async Task<AsyncResult> DetachFiles(string productId, string[] fileIds)
 {
     var token = authStore.LoadToken();
     using (var client = new BearerHttpClient(token.AccessToken))
     {
         var q = string.Join(",", fileIds);
         var uriString = string.Format("api/products/{0}/files?ids={1}", productId, q);
         var uri = new Uri(uriString, UriKind.Relative);
         var resp = await client.DeleteAsync(uri);
         return new AsyncResult { Succeed = resp.StatusCode == HttpStatusCode.OK };
     }
 }
Exemplo n.º 2
0
 public async Task<AsyncResult> Delete(List<string> ids)
 {
     var succeed = false;
     var token = authStore.LoadToken();
     using (var client = new BearerHttpClient(token.AccessToken))
     {
         var q = string.Join(",", ids);
         var uriString = string.Concat("api/products?ids=", q);
         var uri = new Uri(uriString, UriKind.Relative);
         var resp = await client.DeleteAsync(uri);
         if (resp.StatusCode == HttpStatusCode.OK)
         {
             succeed = true;
         }
     }
     return new AsyncResult { Succeed = succeed };
 }