I'm doing a system with Entity Framework and Web Api. It has happened to me that I can only pass an object to the Api, I can not send a string, this why is it? Where do you configure that you only receive one object? and not only that, that the object has to be of a defined class, I do not know if it is understood, that's how it works for me.
[HttpPost]
[Route("Get")]
public L_Persona Get(L_Persona in_obj)
{
L_CabeceraUbicacion a = L_Persona.get(in_obj);
return a;
}
But that's not how it works for me:
[HttpPost]
[Route("Get")]
public L_Persona Get(int id)
{
L_Persona a = L_Persona.get(id);
return a;
}
If I have to pass a id
, for it to work I have to pass a person object with the id
and the other empty fields, when the id
could pass directly.
It also happens to me that I want to send an image and I get an error too, something like that
415 unsupported media type
How do I configure then that the Api Web receives what I want to pass to it and not always an object?