1
にIDとPOSTデータの両方を渡す:MVCのWeb APIは、私は私が呼び出すことができるPUTメソッドを持っていると思います方法
localhost/api/editRole/id and pass post-data.
私のルートは次のようになります。
routeTemplate: "api/{controller}/{action}/{id}"
それから私は、次の方法を試みた。
[HttpPut]
public bool editRole(int id, roleDTO postdata)
{
return dal.editRole(postdata);
}
をしかし、私はいくつかのポスト・データでlocalhost/api/editRole/2
を呼び出そうと私はを取得します
私は間違っていますか?
ようにすべきですか? –
@Vermillionこの回答をチェック:http://stackoverflow.com/questions/23502198/web-api-405-the-requested-resource-does-not-support-http-method-put – gypsyCoder