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 one Action that takes a parameter for which attribute to update on the model? (/User/ToggleLock/{id}, /User/ToggleAttr/{id} vs /User/Toggle/{id}/{attr})

Upvotes: 0

Views: 92

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038770

I would use POST /Users/ToggleLock/{id} or two actions: POST /Users/Lock/{id} and POST /Users/Unlock/{id}

Upvotes: 2

Related Questions