An example of basic model binding to an object in ASP.NET MVC or the ASP.NET Web API might look like this (using C# as example):
public class MyModel
{
public string value1 { get; set; }
public string value2 { get; set; }
}
public ValuesController : ApiController
{
public HttpResponseMessage Post(MyModel model) { ... }
}
As long as the POST body looks like value1=somevalue&value2=someothervalue
things map just fine.
But how do I handle a scenario where the post body contains parameter names that are disallowed as class property names, such as body-text=bla&...
?
You should be able to utilize data serialization attributes to help you with this: