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:
then in both controllers I have the following:Code:..... PartialViewResult summary = GetSectionSummaryPartialViewResult(sectionControllerName,policyZoneID ,sectionID); return summary; }
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.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": .......




Reply With Quote