Пример #1
0
 public OrderItem Create(long orderId,OrderItemRequest orderItem)
 {
     var request = new RestRequest
       {
           Resource = _orderItemPath,
           Method = Method.POST
       };
       request.RequestFormat = DataFormat.Json;
       request.AddParameter("orderId", orderId, ParameterType.UrlSegment);
       request.AddBody(orderItem);
       var response = Client.ExecuteWithErrorCheck<OrderItem>(request);
       return response.Data;
 }
Пример #2
0
        public OrderItem CreateWithData(long orderId,OrderItemRequest orderItem, Stream fileData)
        {
            var request = new RestRequest
              {
                  Resource = _orderItemPath,
                  Method = Method.POST
              };
              request.AddParameter("orderId", orderId, ParameterType.UrlSegment);
              request.AddObject(orderItem, "Type", "Url", "Copies", "Sizing", "PriceToUser", "Md5Hash");

              byte[] allData = new byte[fileData.Length];
              fileData.Read(allData,0,allData.Length);
              request.AddFile("image",allData,"image.jpg");
              var response = Client.ExecuteWithErrorCheck<OrderItem>(request);
              fileData.Dispose();
              return response.Data;
        }