示例#1
0
 public void AddCollect(Collect collect)
 {
     var data = downloadWebPage(getFullUrl("admin/collects.xml"), HttpMethod.POST, collect.ToXElement().ToString());
     var x = XDocument.Parse(data).Root;
     collect.LoadXElement(x);
 }
示例#2
0
 public IEnumerable<Collect> GetCollects(int? productID = null, int? collectionID = null, int? page = null, int limit = 50)
 {
     var url = "admin/collects.xml";
     var currentPage = page ?? 1;
     if (productID != null) url += "?product_id=" + productID;
     if (collectionID != null) url += "?collection_id=" + collectionID;
     while (true)
     {
         var data = downloadWebPage(getFullUrl(url + "?page=" + currentPage + "&limit=" + limit), HttpMethod.GET);
         var x = XDocument.Parse(data);
         if (x.Root.Elements().Count() == 0) break;
         foreach (var item in x.Root.Elements())
         {
             var col = new Collect();
             col.LoadXElement(item);
             yield return col;
         }
         if (page != null) break;
         currentPage++;
     }
 }