D4rWiNS
D4rWiNS

Reputation: 2615

I cant make working an httpost call on MVC ( only Get)

I am trying to to a WebServiceApi(for phone app) that insert a row into a database but I cant make it works, It doesn't enter in the function.

I am using REST Easy extension of Firefox to call the post service.

I call http://localhost:1717/api/Personas with 3 parameters idSubvario,idPersona,idinstalacion

But the response of the server is that It cant find a resource HTTP that match with the URI, If i change to http://localhost:1717/api/Personas?idSubvario=2&idPersona=2&idInstalacion=5190 It works, 0_o

This is the function of the Controller

[System.Web.Mvc.HttpPost]
[System.Web.Mvc.AllowAnonymous]
public ActionResult PostPersonaSubvariosXIDSubvariosYIDPersona(int idSubvario,int idPersona, short idInstalacion)
{
    BsPersonas bPersonas = new BsPersonas();
    bPersonas.InsertarPersonaSubvario(idSubvario, idPersona, idInstalacion);

    EmptyResult er = new EmptyResult();
    return er;
}

Why it works like a GET petition if I say that is HttpPost?

Upvotes: 0

Views: 115

Answers (1)

Vipin Nair
Vipin Nair

Reputation: 515

Your URL is calling Personas function in apiController.But in your code the function is having some different name .Thats why you are getting the error.Change your function name to Personas.It will work

Upvotes: 2

Related Questions