I am learning about MVC 3 and I could not understand one aspect of routing.
If I have a route like below:
route. MapRoute ("default", "{controller} / {action} / {ID}"); The route prevents each action on a parameter of the name id only! However, there is no restriction on the name of the controller or the work of this route.
Of course I can define more routes, but there should be a better way to keep track of the way to accept data tokens such as ListID or FieldID. For example: I have a ListController with two actions:
GetListByID (int listID) and GetFieldByID (int fieldID) In this case, I have to define two routes because the parameter name of the function is different, is there a better way to do this? Thanks! No, your actions can take any parameters, except that your parameter "ID" is
if you had this action in the CartControler
the public action URL Add / cart / add / 1234 (int id, int Quantity) / <> code ultimate, R zero quantity but
/ cart / add / 1234 ? Quantity = 4 will set 4 such as
You can also have complex logic here is a good identity < / Div>
Comments
Post a Comment