1234567891011121314151617181920212223242526 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using Microsoft.AspNetCore.Mvc.Razor;
- namespace MySystem
- {
- public class TemplateViewLocationExpander : IViewLocationExpander
- {
- public IEnumerable<string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable<string> viewLocations)
- {
- string[] locations = {
- "/Areas/Admin/Views/BsServer/{1}/{0}.cshtml",
- "/Areas/Admin/Views/MainServer/{1}/{0}.cshtml",
- "/Areas/Admin/Views/JobServer/{1}/{0}.cshtml",
- "/Areas/Admin/Views/CashServer/{1}/{0}.cshtml",
- };
- return locations.Union(viewLocations);
- }
- public void PopulateValues(ViewLocationExpanderContext context)
- {
- context.Values["template"] = context.ActionContext.RouteData.Values["Template"]?.ToString() ?? "Default";
- }
- }
- }
|