public HttpResponseMessage add(ProductOption post) { // Check for errors if (post == null) { return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The post is null")); } else if (ProductOptionType.MasterPostExists(post.product_option_type_id) == false) { return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The product option type does not exist")); } else if (Option.MasterPostExists(post.option_id) == false) { return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The option does not exist")); } // Make sure that the data is valid post.mpn_suffix = AnnytabDataValidation.TruncateString(post.mpn_suffix, 10); post.price_addition = AnnytabDataValidation.TruncateDecimal(post.price_addition, 0, 9999999999.99M); post.freight_addition = AnnytabDataValidation.TruncateDecimal(post.freight_addition, 0, 9999999999.99M); // Add the post ProductOption.Add(post); // Return the success response return(Request.CreateResponse <string>(HttpStatusCode.OK, "The post has been added")); } // End of the add method