Good day!
I have an application where I need to display and process a form with two different HTML -- one for normal page with site-wide master page and one for an iframe inclusion with different design design (HTML code) and other master page.
Right now I have controller with a couple of actions and views for normal page, it's time to create iframe version. The form fields, validation and processing is identical, so I'd like to make it DRY as possible.
Is it possible to inherit controller (without adding anything new to it) to be able to create new Views?
namespace MyControllers
{
public class SomeController : BaseController
{
[HttpGet]
public ActionResult ProcessMyForm()
{
...
}
[HttpPost]
public ActionResult ProcessMyForm(FormCollection form)
{
...
}
}
}
Views will be in /Views/MyController
and
namespace MyControllers
{
public class SomeControllerWithDifferentViews : SomeController
{
// nothing here
}
}
Different views will be in /Views/SomeControllerWithDifferentViews
Does it make sense?