Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ActionResult Index(string version = null)
- {
- if (!string.IsNullOrWhiteSpace(version))
- {
- if (version == "V1")
- return View("Index", new HomeViewModel
- {
- Version = settingsProvider.CurrentApiVersion
- });
- if (version == "V2")
- return View("AngularApp");
- }
- return View("AngularApp");
- }
- ublic class RouteConfig
- {
- public static void RegisterRoutes(RouteCollection routes)
- {
- routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
- //enable attribute routing
- routes.MapMvcAttributeRoutes();
- routes.MapRoute(
- name: "Default",
- url: "{controller}/{action}/{id}",
- defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
- constraints: new
- {
- serverRoute = new ServerRouteConstraint(url =>
- {
- return !url.PathAndQuery.StartsWith("/App-", StringComparison.InvariantCultureIgnoreCase);
- })
- }
- );
- routes.MapRoute(
- name: "angular",
- url: "{*url}",
- defaults: new {controller = "Home", action = "Index"});
- }
- }
- const routes: Routes = [
- {path: '', redirectTo: 'App-Documentation', pathMatch: 'full'}
- ,
- {
- path: '',
- component: LayoutComponent,
- children: [
- {
- path: '',
- component: DocumentationComponent
- },
- {
- path: 'App-Documentation',
- component: DocumentationComponent
- },
- {
- path: 'App-Settings',
- component: AdministrationComponent
- },
- {
- path: 'App-Chat',
- component: ChatComponent
- }
- ]
- },
- { path: '**', redirectTo: 'App-Documentation' }
- ];
- [RoutePrefix("")]
- public class ClientApiController : ApiBaseController
- {
- serverRoute = new ServerRouteConstraint(url =>
- {
- return !url.PathAndQuery.StartsWith("/App-", StringComparison.InvariantCultureIgnoreCase);
- })
- routes.MapRoute(
- name: "angular",
- url: "{*url}",
- defaults: new {controller = "Home", action = "Index"});
- { path: '**', redirectTo: 'App-Documentation' }
Add Comment
Please, Sign In to add comment