开发者

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}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜