public string serializeJSON(ProductsModel product) { string jsonString = JsonConvert.SerializeObject(product, new JsonSerializerSettings { PreserveReferencesHandling = PreserveReferencesHandling.Objects }); return(jsonString); }
public static async void SoldProduct(ProductsModel products, int quantity) { await apiClient.PostAsync("api/Rest/product/SoldProduct?quantitySold=" + quantity, new StringContent(jsonHelper.serializeJSON(products), System.Text.Encoding.UTF8, "application/json")); }
public static async void insertProducts(ProductsModel product) { await apiClient.PostAsync("api/Rest/product/InsertOneProductJSON", new StringContent(jsonHelper.serializeJSON(product), System.Text.Encoding.UTF8, "application/json")); }