Hello,
I meet a problem when a call URI ODATA Controller with DATAs in POST HTTP Action. No binding between the parameter of my function and the Json data in BODY Request.
But when I put a breakpoint in my web api function and call : Request.Content.ReadAsStringAsync().Result, I get my parameter string with JSON stringlify.
The same sample with APIController work fine, binding parameter is ok.
This is my code controller code
// POST : /Lead
public IHttpActionResult PostLead(fiche message)
{
var parameters = Request.Content.ReadAsStringAsync().Result;
fiche result = JsonConvert.DeserializeObject<fiche>(parameters);
message = result;
return Ok<string>("Alive !!!" + message.nom);
}
public class fiche
{
public virtual int ID { get; set; }
public virtual string nom { get; set; }
public virtual string message { get; set; }
}
and calling in Fiddler : POST Operation
http://localhost/ODataExtendActionPoc/odata/Leads
Request Body
{
"ID":"0",
"message" : "test",
"nom":"kkk"
}
I try all attributes :-), I lost my Latina Language !!! LOL
Thanxs for help.
]:TWR:[
// POST : /Leadpublic IHttpActionResult PostLead(fiche message) { var parameters = Request.Content.ReadAsStringAsync().Result; fiche result = JsonConvert.DeserializeObject<fiche>(parameters); message = result; return Ok<string>("Alive !!!" + message.nom); }