/// <summary> /// Allows for the REST API to delete a product from the store /// </summary> /// <param name="parameters"> /// Parameters passed in the URL of the REST API call. A single parameter (product ID/bvin) is /// expected. /// </param> /// <param name="querystring">Name/value pairs from the REST API call querystring. Not used in this method.</param> /// <param name="postdata">This parameter is not used in this method</param> /// <returns> /// String - a JSON representation of the Errors/Content to return. Content will contain either True or False, /// depending on success of the deletion /// </returns> public override string DeleteAction(string parameters, NameValueCollection querystring, string postdata) { var data = string.Empty; var bvin = FirstParameter(parameters); if (bvin == string.Empty) { var howManyString = querystring["howmany"]; var howMany = 0; int.TryParse(howManyString, out howMany); // Clear All Products Requested var response = new ApiResponse <ClearProductsData> { Content = HccApp.ClearProducts(howMany) }; data = Json.ObjectToJson(response); } else { // Single Item Delete var response = new ApiResponse <bool> { Content = HccApp.CatalogServices.DestroyProduct(bvin, HccApp.CurrentStore.Id) }; data = Json.ObjectToJson(response); } return(data); }