MR.ABC
MR.ABC

Reputation: 4862

How to have Controller for a Subviewfolder

I like to have a controller for multiple views. The structure should look like these.

enter image description here

enter image description here

Is it possible or anybody have an good idea too avoid view names like AddQuantityProduct.cshtml, AddMatrixProduct.cshtml.

Upvotes: 0

Views: 25

Answers (1)

asp_net
asp_net

Reputation: 3597

Although I don't think it's a good idea to blow your controller up with so much functionality, you can easily do that by specifying the full path of the view in each action.

Example:

public ActionResult Foo()
{
    return View("~/Views/Products/Add/MatrixProduct.cshtml");
}

Upvotes: 1

Related Questions