I have two idential controllers in two seperate areas within my project.
The only difference between the two is the base controller.
- BrowsingSessionController : Area1BaseController
- BrowsingSessionController : Area2BaseController
The controllers themselves are quite meaty and return Views or RedirectToActions based on conditions.
I don't want to repeat myself in terms and wish to adhere to the DRY principle and wondered how to maintain the controller structure but avoid repeating the code.
Sample of Method
BrowsingSessionControllerContent
...
case ("byexpiry"): // Expiry Grid
currentTemplateModel._TemplateExpiry =
_browsingSessionTemplateRepository.GetBrowsingSessionLeadExpiryTemplateById(currentTemplateModel.Id);
return View("SessionExpiryGrid",
new SessionExpiryGridModel()
{
ActiveBrowsingSessionTemplate = currentTemplateModel,
SessionGuid = guid
});
...