Exemplo n.º 1
0
        public static void Configure(HttpConfiguration httpConfig, DexCMSConfiguration config)
        {
            JsonMediaTypeFormatter jsonFormatter = httpConfig.Formatters.JsonFormatter;
            List<string> supportedMediaTypes = config.RetrieveValue<List<string>>(CoreApiOptions.SupportedMediaTypes.ToString());
            if (supportedMediaTypes == null)
            {
                supportedMediaTypes = new List<string>
                {
                    "text/html"
                };
            }

            if (supportedMediaTypes != null)
            {
                foreach (var mediaType in supportedMediaTypes)
                {
                    jsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue(mediaType));
                }
            }
            if (!config.RetrieveValue<bool>(CoreApiOptions.IgnoreReferenceHandling.ToString()))
            {
                jsonFormatter.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
            }
            if (!config.RetrieveValue<bool>(CoreApiOptions.UseCamelCase.ToString()))
            {
                jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
            }
        }
Exemplo n.º 2
0
        public static void CreateDefaultRoutes(RouteCollection routes, DexCMSConfiguration config)
        {
            routes.MapRoute(
                name: "EvetFaqItems",
                url: "EventFaqItems/{action}/{id}",
                defaults: new { controller = "EventFaqItems" });

            routes.MapRoute(
                name: "Events",
                url: "Events/{urlSegment}",
                defaults: new { category = "events", controller = "Events", action = "Index" });

            routes.MapRoute(
                name: "EventSchedule",
                url: "Events/{category}/Schedule",
                defaults: new { urlSegment = "schedule", action = "Schedule", controller = "Events" });

            routes.MapRoute(
                name: "EventPrice",
                url: "Events/{category}/Prices",
                defaults: new { urlSegment = "prices", action = "Prices", controller = "Events" });

            routes.MapRoute(
                name: "EventRegistration",
                url: "Events/{category}/Registration",
                defaults: new { urlSegment = "registration", action = "Registration", controller = "Events" });

            routes.MapRoute(
                name: "EventFaq",
                url: "Events/{category}/FAQ",
                defaults: new { urlSegment = "faq", action = "FAQ", controller = "Events" });
        }
Exemplo n.º 3
0
        public static void ControlPanelDefaultRoutes(AreaRegistrationContext context, DexCMSConfiguration config)
        {
            string[] ControlPanelNamespaces = new[] { "DexCMS.Base.Mvc.Controllers.ControlPanel" };

            context.MapRoute(
                "ControlPanel_default",
                "ControlPanel/{*routes}",
                new { action = "Index", controller = "ControlPanel", area = "ControlPanel", category="none" },
                ControlPanelNamespaces
            );
        }
Exemplo n.º 4
0
        public static void CreateDefaultRoutes(RouteCollection routes, DexCMSConfiguration config)
        {
            routes.MapRoute(
                name: "Calendar",
                url: "Calendar",
                defaults: new { category = "none", urlSegment = "calendar", controller = "Calendar", action = "Index" });

            routes.MapRoute(
                name: "CalendarSubMethods",
                url: "Calendar/{action}",
                defaults: new { controller = "Calendar" });
        }
Exemplo n.º 5
0
        public static void CreateDefaultRoutes(HttpConfiguration httpConfig, DexCMSConfiguration config)
        {
            string baseApi = config.RetrieveValue<string>(CoreApiOptions.CoreApiUrl.ToString());
            if (string.IsNullOrEmpty(baseApi))
            {
                baseApi = "api";
            }

            httpConfig.Routes.MapHttpRoute(
                name: "FileUpload",
                routeTemplate: baseApi + "/fileupload/upload",
                defaults: new { controller = "fileupload", action = "upload" }
            );

            httpConfig.Routes.MapHttpRoute(
                name: "RoleApi",
                routeTemplate: baseApi + "/roles/{id}",
                defaults: new { controller = "roles", id = RouteParameter.Optional }
            );

            httpConfig.Routes.MapHttpRoute(
                name: "UserApi",
                routeTemplate: baseApi + "/users/{id}",
                defaults: new { controller = "users", id = RouteParameter.Optional }
            );

            httpConfig.Routes.MapHttpRoute(
                name: "DefaultApiGetAll",
                routeTemplate: baseApi + "/{controller}"
            );

            httpConfig.Routes.MapHttpRoute(
                name: "CompositeApi",
                routeTemplate: baseApi + "/{controller}/{id}/{secondKey}",
                defaults: new { },
                constraints: new { id = @"^[0-9]+$", secondKey = @"^[0-9]+$" }
            );

            httpConfig.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: baseApi + "/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional },
                constraints: new { id = @"^[0-9]+$" }
            );

            httpConfig.Routes.MapHttpRoute(
                name: "DefaultApiByGroupID",
                routeTemplate: baseApi + "/{controller}/{bytype}/{id}",
                defaults: null,
                constraints: new { id = @"^[0-9]+$" }
            );
        }
Exemplo n.º 6
0
        public static void CreateDefaultRoutes(HttpConfiguration httpConfig, DexCMSConfiguration config)
        {
            string baseApi = config.RetrieveValue<string>(CoreApiOptions.CoreApiUrl.ToString());
            if (string.IsNullOrEmpty(baseApi))
            {
                baseApi = "api";
            }

            httpConfig.Routes.MapHttpRoute(
                name: "RetrieveContent",
                routeTemplate: baseApi + "/retrievecontents/{contentName}",
                defaults: new { controller = "retrievecontents" });
        }
Exemplo n.º 7
0
 public static void CreateDefaultRoutes(RouteCollection routes, DexCMSConfiguration config)
 {
     routes.MapRoute(
         name: "Faqs",
         url: "faqs",
         defaults: new { category = "none", controller = "FaqItems", action = "Index", urlSegment = "faqs" }
     );
     routes.MapRoute(
         name: "FaqsHelpful",
         url: "faqs/helpful/{id}",
         defaults: new { category = "none", controller = "FaqItems", action = "Helpful", urlSegment = "faqs" }
     );
     routes.MapRoute(
         name: "FaqsUnhelpful",
         url: "faqs/unhelpful/{id}",
         defaults: new { category = "none", controller = "FaqItems", action = "Unhelpful", urlSegment = "faqs" }
     );
 }
Exemplo n.º 8
0
        public static void CreateDefaultRoutes(RouteCollection routes, DexCMSConfiguration config)
        {
            routes.MapRoute(
                "boom", "boom", new { controller = "PublicContent", action = "Boom" });

            routes.MapRoute(
                "sitemap", "sitemap.xml", new { controller = "Sitemap", action = "Index" });

            routes.MapRoute(
                name: "Contact",
                url: "contact",
                defaults: new { category = "none", controller = "Contact", action = "Index", urlSegment = "contact" }
            );

            routes.MapRoute(
                name: "ContactSuccess",
                url: "contact/success",
                defaults: new { category = "contact", controller = "Contact", action = "Success", urlSegment = "success" }
            );

            if (!config.RetrieveValue<bool>(BaseRouteOptions.DisableAccountRoutes.ToString()))
            {
                routes.MapRoute(
                    name: "Account",
                    url: "Account/{action}",
                    defaults: new { category = "account", controller = "Account" });

                routes.MapRoute(
                    name: "Manage",
                    url: "Manage",
                    defaults: new { category = "none", controller = "Manage", action = "Index", urlSegment = "manage" });

                routes.MapRoute(
                    name: "ManageActions",
                    url: "Manage/{action}",
                    defaults: new { category = "manage", controller = "Manage" });
            }

            //root page
            routes.MapRoute(
                name: "Default",
                url: "",
                defaults: new { urlSegment = "index", controller = "PublicContent", action = "Index" }
            );

            //THESE are the catch all routes that display dynamic content
            routes.MapRoute(
                name: "Content",
                url: "{urlSegment}",
                defaults: new { controller = "PublicContent", action = "RetrieveContent" }
            );

            routes.MapRoute(
                name: "ContentCategory",
                url: "{category}/{urlSegment}",
                defaults: new { controller = "PublicContent", action = "RetrieveContentByCategory" }
            );

            routes.MapRoute(
                name: "ContentSubCategory",
                url: "{category}/{subCategory}/{urlSegment}",
                defaults: new { controller = "PublicContent", action = "RetrieveContentBySubCategory" }
            );
        }