using System.Linq; using System.Web.Mvc; namespace Neo.LegitimateLicences.Web.FrameworkExtensions { public class CustomViewEngine : RazorViewEngine { /// /// Custom view engine to allow for sub folders /// Add the following to Global.Asax /// ViewEngines.Engines.Add(new CustomViewEngine()); /// {1} = Controller Name /// {0} = Action name /// public CustomViewEngine() { var newLocationFormats = new[] { "~/Views/Common/{1}/{0}.cshtml", "~/Views/Admin/{1}/{0}.cshtml", "~/Views/Pathways/{1}/{0}.cshtml", "~/Views/SelfService/{1}/{0}.cshtml", "~/Views/System/{1}/{0}.cshtml" }; PartialViewLocationFormats = PartialViewLocationFormats.Union(newLocationFormats).ToArray(); } } }