예제 #1
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapHttpRoute(
                "DefaultApiWithId",
                "Admin/api/{controller}/{id}",
                new { id = RouteParameter.Optional }, new { id = @"\d+" });

            context.MapHttpRoute(
                "DefaultApiWithAction",
                "Admin/api/{controller}/{action}"
                );
            context.MapHttpRoute(
                "DefaultApiWithActionAndId",
                "Admin/api/{controller}/{action}/{id}"
                );
            context.MapHttpRoute(
                "DefaultApiWithController",
                "Admin/api/{controller}"
                );

            /////////////////////////
            //METHOD
            ////////////////////////
            context.MapRoute(
                "Admin_controlPanel",
                "Admin-area/",
                new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                namespaces: new[] { "PenDesign.WebUI.Areas.Admin.Controllers" }
                );

            context.MapRoute(
                "Admin_default",
                "Admin/",
                new { controller = "Home", action = "Login", id = UrlParameter.Optional },
                namespaces: new[] { "PenDesign.WebUI.Areas.Admin.Controllers" }
                );


            RouteTable.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{action}/{id}",
                defaults: new { id = RouteParameter.Optional }
                ).RouteHandler = new PenDesign.WebUI.MvcApplication.SessionStateRouteHandler();

            var jsonFormatter = GlobalConfiguration.Configuration.Formatters.JsonFormatter;

            jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
        }
예제 #2
0
 /// <summary>
 /// Registers the Api area.
 /// </summary>
 /// <param name="context"></param>
 public override void RegisterArea(AreaRegistrationContext context)
 {
     context.MapHttpRoute(
         name: "Api_default",
         routeTemplate: "Api/{controller}/{id}",
         defaults: new { id = RouteParameter.Optional }
         );
 }
        /// <summary>
        /// Create the routes for the area
        /// </summary>
        /// <param name="context"></param>
        /// <remarks>
        /// By using the context to register the routes it means that the area is already applied to them all
        /// and that the namespaces searched for the controllers are ONLY the ones specified.
        /// </remarks>
        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "umbraco-install",
                "Install",
                new { controller = "Install", action = "Index", id = UrlParameter.Optional },
                new[] { typeof(InstallController).Namespace });

            //TODO: We can remove this when we re-build the back office package installer
            //Create the install routes
            context.MapHttpRoute(
                "Umbraco_install_packages",
                "Install/PackageInstaller/{action}/{id}",
                new { controller = "InstallPackage", action = "Index", id = UrlParameter.Optional },
                new[] { typeof(InstallPackageController).Namespace });

            context.MapHttpRoute(
                "umbraco-install-api",
                "install/api/{action}/{id}",
                new { controller = "InstallApi", action = "Status", id = RouteParameter.Optional },
                new[] { typeof(InstallApiController).Namespace });
        }
예제 #4
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapHttpRoute(
                "AreaRea_DefaultApi",
                "AreaRea/api/{controller}/{id}",
                defaults: new { id = System.Web.Http.RouteParameter.Optional });

            context.MapRoute(
                "AreaRea_default",
                "AreaRea/{controller}/{action}/{id}",
                new { action = "Index", id = UrlParameter.Optional }
                );
        }
        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapHttpRoute(
                "Customer_DefaultApi",
                "Customer/api/{controller}/{id}",
                new { id = RouteParameter.Optional }
                );

            context.MapRoute(
                "Customer_default",
                "Customer/{controller}/{action}/{id}",
                new { action = "Index", id = UrlParameter.Optional }
                );
        }
        /// <summary>
        /// Create the routes for the area
        /// </summary>
        /// <param name="context"></param>
        /// <remarks>
        /// By using the context to register the routes it means that the area is already applied to them all
        /// and that the namespaces searched for the controllers are ONLY the ones specified.
        /// </remarks>
        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "umbraco-install",
                "Install",
                new { controller = "Install", action = "Index", id = UrlParameter.Optional },
                new[] { typeof(InstallController).Namespace });

            context.MapHttpRoute(
                "umbraco-install-api",
                "install/api/{action}/{id}",
                new { controller = "InstallApi", action = "Status", id = RouteParameter.Optional },
                new[] { typeof(InstallApiController).Namespace });
        }
예제 #7
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapHttpRoute(
                "Area51_DefaultApi",
                "Area51/api/{controller}/{id}",
                defaults: new { id = System.Web.Http.RouteParameter.Optional });

            context.MapRoute(
                "Area51_default",
                "Area51/{controller}/{action}/{id}",
                new { action = "Index", id = UrlParameter.Optional }
                );

            context.SetDependencyResolver(new UnityDependencyResolver(UnityConfig.GetConfiguredContainer()));
        }
예제 #8
0
 public static Route MapHttpRoute(this AreaRegistrationContext context, string name, string routeTemplate)
 {
     return(context.MapHttpRoute(name, routeTemplate, null, null));
 }
 public static Route MapHttpRoute(this AreaRegistrationContext context, string name, string routeTemplate, object defaults)
 {
     return context.MapHttpRoute(name, routeTemplate, defaults, null);
 }