views:

27

answers:

1

Hello I have actions SomethingEditor, SomethingDelete, SomethingSave, SomethingAdd and i want set these routing: site/Something/Editor, site/Something/Delete, site/Something/Save etc

How i can do it?

+1  A: 

Using the following routes:

routes.MapRoute(null, "site/Something/Editor", new { controller = "Something", action = "SomethingEditor" });
routes.MapRoute(null, "site/Something/Delete", new { controller = "Something", action = "SomethingDelete" });
routes.MapRoute(null, "site/Something/Save", new { controller = "Something", action = "SomethingSave" });
routes.MapRoute(null, "site/Something/Add", new { controller = "Something", action = "SomethingAdd" });


UPDATE:

I strongly recommend using a seperate controller for each entity with the following route:

routes.MapRoute(null, "site/{controller}/{action}");
Fabian
Well. Can i just add prefix [something] to action? If i have many actions it's hard work.
Neir0
Not out of the box atleast. Tt might be possible with a custom httphandler but i strongly recommend using a seperate controller for each entity.
Fabian