This simple problem can cause a real headache!
I can see your controller EDIT
(PUT
) method expects 2 parameters: a) an int id, and b) a department object.
It is the default code when you generate this from VS > add controller with read/write options. However, you have to remember to consume this service using the two parameters, otherwise you will get the error 405.
In my case, I did not need the id parameter for PUT
, so I just dropped it from the header... after a few hours of not noticing it there! If you keep it there, then the name must also be retained as id, unless you go on to make necessary changes to your configurations.