Hi All,

I have 2 controllers that have an ActionResult. The ActionResults get called by the respective views and some parameters are set. At the end of each Action result I call a method on each of the controllers in the form:

Code:
.....
PartialViewResult summary = GetSectionSummaryPartialViewResult(sectionControllerName,policyZoneID ,sectionID);
            
            return summary;
        }
then in both controllers I have the following:

Code:
private PartialViewResult GetSectionSummaryPartialViewResult(string sectionControllerName,int policyZoneID, int sectionID)
        {
            PartialViewResult viewResult;

            switch (sectionControllerName)
            {
                case "GoodsInTransitSection" :
                    GoodsInTransitSectionAndRisksViewModel gitViewModel = GoodsInTransitSectionService.GetGoodsInTransitSectionAndRiskViewModel(policyZoneID, sectionID);
                    viewResult = PartialView("SectionSummary/GoodsInTransitSectionSummaryData", gitViewModel);
                    break;
                case "FrozenFoodsSection":
                   .......
This all works fine, but at the moment having my code this way means that I have to maintain the method in 2 controllers when I really only want one copy of the method and it be called from both.