开发者

In which controller do you put the CRUD for the child part of a relationship?

I am using ASP.Net MVC but this probably applies to all MVC patterns in general. My problem, for example I have companies and in each company I have a list of contacts. When I have selected a company I can see its details and a list of the contacts for that company. When I want to add a new contact for that company, should the implementation of that action g开发者_高级运维o into the company controller as an "AddContact" action or should it go into the contact controller into a "New" action and we pass the Company ID in the URL?

What is the usual way of dealing with this sort of thing in ASP.Net MVC? Is there a better stategy?


In a RESTful application this should go to the New action of the ContactsController. You need to pass the company id as well to this action.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜