开发者

is it possible to define an area in MVC that will also act as a Controller with AreaViewEngine from s#arp architecture

开发者 https://www.devze.com 2023-01-13 16:49 出处:网络
i would like to do this in my MVC application: localhost/Enterprises localhost/Enterprises/Create localhost/Enterprises/Details/1

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开发者_如何学JAVA

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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消