views:

34

answers:

2

hi every one!

i would like to do this in my MVC application:

  • localhost/Enterprises
  • localhost/Enterprises/Create
  • localhost/Enterprises/Details/1
  • localhost/Enterprises/1/Publications
  • localhost/Enterprises/1/Publications/Create
  • localhost/Enterprises/1/Publications/Details/1

With this, i can read that i would like to Create a Publication for an Enterprise of Id = 1. Im i correct by doing this that way?

if yes, i guest that i need to use Area from MVC with the help of the AreaViewEngine from S#arp Architecture. But i have a problem. If i register "Enterprises" to be an area, the controller for Enterprises will not answer properly. localhost/Enterprises/Create will not be seen because he think that its a call for the Area and not for the Controller.

any suggestion? or a better way for doing this?

thank you

alex

+2  A: 

You just need to use routing to handle what you are wanting to do. I would suggest reading up on routing and what you can do with that.

In this particular case, an area will probably be overkill. Areas were really designed to break the application up into more manageable chunks. Some look at areas as sub applications, some look at them as application partitions. I say it really depends on what you are trying to do and what your needs are.

Alec Whittington
Agreed. Looking at the routing is the answer here. Areas are auxiliary to this.
Martin Aatmaa
you are right... its seems to be a routing configuration that i need to do. Thank you for the help!
Alexandre Jobin
glad we could help.
Alec Whittington
+2  A: 

Take a look at : http://stevehodgkiss.com/blog/2010/03/21/restful-routing-for-asp-net-mvc-2/

I think you'll be able to use that to achieve what you want.

Christopher Stott
thank you for the link. It seems to be what i need!
Alexandre Jobin