using Microsoft.AspNetCore.Mvc.Razor; namespace Nop.Plugin.Misc.MangoCore.Infrastructure; public class ViewLocationExpander : IViewLocationExpander { /// /// Invoked by a to determine the values that would be consumed by this instance /// of . The calculated values are used to determine if the view location /// has changed since the last time it was located. /// /// The for the current view location /// expansion operation. public void PopulateValues(ViewLocationExpanderContext context) { } /// /// Invoked by a to determine potential locations for a view. /// /// The for the current view location /// expansion operation. /// The sequence of view locations to expand. /// A list of expanded view locations. public IEnumerable ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable viewLocations) { if (context.AreaName == "Admin") { viewLocations = new[] { $"/Plugins/Nop.Plugin.Misc.MangoCore/Areas/Admin/Views/{context.ControllerName}/{context.ViewName}.cshtml" }.Concat(viewLocations); } else { viewLocations = new[] { $"/Plugins/Nop.Plugin.Misc.MangoCore/Views/{context.ControllerName}/{context.ViewName}.cshtml" }.Concat(viewLocations); } return viewLocations; } }