开发者

Update model from Index action

开发者 https://www.devze.com 2023-02-25 06:47 出处:网络
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/unche

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

精彩评论

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

关注公众号