Exemplo n.º 1
0
 /// <summary>
 /// Deserialize the object
 /// </summary>
 public virtual void DeserializeJson(JToken inputObject)
 {
     if (inputObject != null && inputObject.Type != JTokenType.Null)
     {
         JToken colorValue = inputObject["Color"];
         if (colorValue != null && colorValue.Type != JTokenType.Null)
         {
             this.Color = ((string)colorValue);
         }
         JToken discontinuedDateValue = inputObject["DiscontinuedDate"];
         if (discontinuedDateValue != null && discontinuedDateValue.Type != JTokenType.Null)
         {
             this.DiscontinuedDate = ((string)discontinuedDateValue);
         }
         JToken listPriceValue = inputObject["ListPrice"];
         if (listPriceValue != null && listPriceValue.Type != JTokenType.Null)
         {
             this.ListPrice = ((double)listPriceValue);
         }
         JToken modifiedDateValue = inputObject["ModifiedDate"];
         if (modifiedDateValue != null && modifiedDateValue.Type != JTokenType.Null)
         {
             this.ModifiedDate = ((DateTimeOffset)modifiedDateValue);
         }
         JToken nameValue = inputObject["Name"];
         if (nameValue != null && nameValue.Type != JTokenType.Null)
         {
             this.Name = ((string)nameValue);
         }
         JToken productCategoryValue = inputObject["ProductCategory"];
         if (productCategoryValue != null && productCategoryValue.Type != JTokenType.Null)
         {
             ProductCategory productCategory = new ProductCategory();
             productCategory.DeserializeJson(productCategoryValue);
             this.ProductCategory = productCategory;
         }
         JToken productCategoryIDValue = inputObject["ProductCategoryID"];
         if (productCategoryIDValue != null && productCategoryIDValue.Type != JTokenType.Null)
         {
             this.ProductCategoryID = ((string)productCategoryIDValue);
         }
         JToken productIDValue = inputObject["ProductID"];
         if (productIDValue != null && productIDValue.Type != JTokenType.Null)
         {
             this.ProductID = ((int)productIDValue);
         }
         JToken productModelValue = inputObject["ProductModel"];
         if (productModelValue != null && productModelValue.Type != JTokenType.Null)
         {
             ProductModel productModel = new ProductModel();
             productModel.DeserializeJson(productModelValue);
             this.ProductModel = productModel;
         }
         JToken productModelIDValue = inputObject["ProductModelID"];
         if (productModelIDValue != null && productModelIDValue.Type != JTokenType.Null)
         {
             this.ProductModelID = ((string)productModelIDValue);
         }
         JToken productNumberValue = inputObject["ProductNumber"];
         if (productNumberValue != null && productNumberValue.Type != JTokenType.Null)
         {
             this.ProductNumber = ((string)productNumberValue);
         }
         JToken rowguidValue = inputObject["rowguid"];
         if (rowguidValue != null && rowguidValue.Type != JTokenType.Null)
         {
             this.Rowguid = ((string)rowguidValue);
         }
         JToken salesOrderDetailsSequence = ((JToken)inputObject["SalesOrderDetails"]);
         if (salesOrderDetailsSequence != null && salesOrderDetailsSequence.Type != JTokenType.Null)
         {
             foreach (JToken salesOrderDetailsValue in ((JArray)salesOrderDetailsSequence))
             {
                 SalesOrderDetail salesOrderDetail = new SalesOrderDetail();
                 salesOrderDetail.DeserializeJson(salesOrderDetailsValue);
                 this.SalesOrderDetails.Add(salesOrderDetail);
             }
         }
         JToken sellEndDateValue = inputObject["SellEndDate"];
         if (sellEndDateValue != null && sellEndDateValue.Type != JTokenType.Null)
         {
             this.SellEndDate = ((string)sellEndDateValue);
         }
         JToken sellStartDateValue = inputObject["SellStartDate"];
         if (sellStartDateValue != null && sellStartDateValue.Type != JTokenType.Null)
         {
             this.SellStartDate = ((DateTimeOffset)sellStartDateValue);
         }
         JToken sizeValue = inputObject["Size"];
         if (sizeValue != null && sizeValue.Type != JTokenType.Null)
         {
             this.Size = ((string)sizeValue);
         }
         JToken standardCostValue = inputObject["StandardCost"];
         if (standardCostValue != null && standardCostValue.Type != JTokenType.Null)
         {
             this.StandardCost = ((double)standardCostValue);
         }
         JToken thumbNailPhotoValue = inputObject["ThumbNailPhoto"];
         if (thumbNailPhotoValue != null && thumbNailPhotoValue.Type != JTokenType.Null)
         {
             this.ThumbNailPhoto = ((string)thumbNailPhotoValue);
         }
         JToken thumbnailPhotoFileNameValue = inputObject["ThumbnailPhotoFileName"];
         if (thumbnailPhotoFileNameValue != null && thumbnailPhotoFileNameValue.Type != JTokenType.Null)
         {
             this.ThumbnailPhotoFileName = ((string)thumbnailPhotoFileNameValue);
         }
         JToken weightValue = inputObject["Weight"];
         if (weightValue != null && weightValue.Type != JTokenType.Null)
         {
             this.Weight = ((string)weightValue);
         }
     }
 }
 /// <summary>
 /// Deserialize the object
 /// </summary>
 public virtual void DeserializeJson(JToken inputObject)
 {
     if (inputObject != null && inputObject.Type != JTokenType.Null)
     {
         JToken modifiedDateValue = inputObject["ModifiedDate"];
         if (modifiedDateValue != null && modifiedDateValue.Type != JTokenType.Null)
         {
             this.ModifiedDate = ((DateTimeOffset)modifiedDateValue);
         }
         JToken nameValue = inputObject["Name"];
         if (nameValue != null && nameValue.Type != JTokenType.Null)
         {
             this.Name = ((string)nameValue);
         }
         JToken parentProductCategoryValue = inputObject["ParentProductCategory"];
         if (parentProductCategoryValue != null && parentProductCategoryValue.Type != JTokenType.Null)
         {
             ProductCategory productCategory = new ProductCategory();
             productCategory.DeserializeJson(parentProductCategoryValue);
             this.ParentProductCategory = productCategory;
         }
         JToken parentProductCategoryIDValue = inputObject["ParentProductCategoryID"];
         if (parentProductCategoryIDValue != null && parentProductCategoryIDValue.Type != JTokenType.Null)
         {
             this.ParentProductCategoryID = ((string)parentProductCategoryIDValue);
         }
         JToken productCategoriesSequence = ((JToken)inputObject["ProductCategories"]);
         if (productCategoriesSequence != null && productCategoriesSequence.Type != JTokenType.Null)
         {
             foreach (JToken productCategoriesValue in ((JArray)productCategoriesSequence))
             {
                 ProductCategory productCategory2 = new ProductCategory();
                 productCategory2.DeserializeJson(productCategoriesValue);
                 this.ProductCategories.Add(productCategory2);
             }
         }
         JToken productCategoryIDValue = inputObject["ProductCategoryID"];
         if (productCategoryIDValue != null && productCategoryIDValue.Type != JTokenType.Null)
         {
             this.ProductCategoryID = ((int)productCategoryIDValue);
         }
         JToken productsSequence = ((JToken)inputObject["Products"]);
         if (productsSequence != null && productsSequence.Type != JTokenType.Null)
         {
             foreach (JToken productsValue in ((JArray)productsSequence))
             {
                 Product product = new Product();
                 product.DeserializeJson(productsValue);
                 this.Products.Add(product);
             }
         }
         JToken rowguidValue = inputObject["rowguid"];
         if (rowguidValue != null && rowguidValue.Type != JTokenType.Null)
         {
             this.Rowguid = ((string)rowguidValue);
         }
     }
 }
 /// <param name='operations'>
 /// Reference to the Engine.API.IProductCategories.
 /// </param>
 /// <param name='id'>
 /// Required.
 /// </param>
 /// <param name='productCategory'>
 /// Required.
 /// </param>
 public static object PutProductCategoryByIdAndProductcategory(this IProductCategories operations, int id, ProductCategory productCategory)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IProductCategories)s).PutProductCategoryByIdAndProductcategoryAsync(id, productCategory);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
 /// <param name='operations'>
 /// Reference to the Engine.API.IProductCategories.
 /// </param>
 /// <param name='id'>
 /// Required.
 /// </param>
 /// <param name='productCategory'>
 /// Required.
 /// </param>
 /// <param name='cancellationToken'>
 /// Cancellation token.
 /// </param>
 public static async Task<object> PutProductCategoryByIdAndProductcategoryAsync(this IProductCategories operations, int id, ProductCategory productCategory, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     Microsoft.Rest.HttpOperationResponse<object> result = await operations.PutProductCategoryByIdAndProductcategoryWithOperationResponseAsync(id, productCategory, cancellationToken).ConfigureAwait(false);
     return result.Body;
 }
 /// <param name='operations'>
 /// Reference to the Engine.API.IProductCategories.
 /// </param>
 /// <param name='productCategory'>
 /// Required.
 /// </param>
 /// <param name='cancellationToken'>
 /// Cancellation token.
 /// </param>
 public static async Task<ProductCategory> PostProductCategoryByProductcategoryAsync(this IProductCategories operations, ProductCategory productCategory, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     Microsoft.Rest.HttpOperationResponse<Engine.API.Models.ProductCategory> result = await operations.PostProductCategoryByProductcategoryWithOperationResponseAsync(productCategory, cancellationToken).ConfigureAwait(false);
     return result.Body;
 }