Question

I am trying to develop project in which I have maintained its components as separate entity with no dependency on other projects. i.e. I will maintain cart as one module and if I need its functionality I simply call its actionresult which gives me the cart on my page that's all.

for developing that I follow the all steps mentioned Here as it is.

I created my project structure as

enter image description here

I have to render view at customer->viwes->customer->index.cshtml in demoplug->views->Home->index.cshtml

for that I am calling the actionresult method as @Html.action("index","customer")

which return me customer view

but it gives me error that view is not found which searches view demoplug -> view folder but it is actually in customer -> view folder

please suggest to overcome that problem.

In future I have to render the different views depending on the theme selected

Was it helpful?

Solution

Have you saved your Customer project in the Areas folder of the DemoPlug project, as the tutorial indicated? If yes, the you should modify your action method to include the area name.

@Url.Action("Index", "Customer", new { area = "Customer"})

To do the reverse and call an action in DemoPlug from the Customer Area, try this:

@Url.Action("MyAction", "DemoPlugController", new { area = "" })
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top