Update model from Index action
In my User controllers Index view I have a table with usernames and some quick controls, such as a checkbox named "Lock". I want to submit a call to toggle a users "Lock" status when I check/uncheck this checkbox.
Is the correct procedure to make separate actions in the controller for each checkbox (I have a couple per line), or should I make on开发者_JS百科e Action that takes a parameter for which attribute to update on the model? (/User/ToggleLock/{id}, /User/ToggleAttr/{id} vs /User/Toggle/{id}/{attr})
I would use POST /Users/ToggleLock/{id}
or two actions: POST /Users/Lock/{id}
and POST /Users/Unlock/{id}
精彩评论