I am interested to know how people deal with the following situation.
Suppose we have a DataField, and each DataField can have an unlimited number of DataValues
We have 2 controllers for handling manipulations with these objects
- DataFieldController
- DataValueContoller
Now, if we need to add a new DataValue, we need to know the identifier CustomDataField. The following URL will be used:
/CustomDataValue/Add/1
1 = DataField ID
However, since the ASp.Net MVC mechanism associates the parameter name with the model (IE in the case below. My DatValeu object will have its identifier replaced when I really try to go through FieldID)
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Site", action = "Home", id = UrlParameter.Optional }
);
? , , .
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Site", action = "Home", id = UrlParameter.Optional }
);
routes.MapRoute(
"Default",
"{controller}/{action}/{fieldid}",
new { controller = "Site", action = "Home", fieldid = UrlParameter.Optional }
);
, , . , , :/String/String/Int
==========================
?
- /DataValue//{DataFieldID}
- /DataValue//{ID}
- /DataValue//{DataFieldID}
3 ?