Beispiel #1
0
        static void Main() {
            DataHelper data = new DataHelper();
            MainHandlers main = new MainHandlers();
            ContentHandlers content = new ContentHandlers();
            CommitHooks hooks = new CommitHooks();

            data.GenerateData();
            main.Register();
            content.Register();
            hooks.Register();
        }
        public void Register()
        {
            RegisterPartials();

            Handle.GET("/website/standalone", () => {
                Session session = Session.Current;

                if (session != null && session.Data != null && session.Data is StandalonePage) {
                    return session.Data as StandalonePage;
                }

                StandalonePage standalone = new StandalonePage();

                if (session == null) {
                    session = new Session(SessionOptions.PatchVersioning);
                }

                standalone.Session = session;
                standalone.User = Self.GET("/sc/mapping/user", () => new Page());

                return standalone;
            });

            Handle.GET("/website/cleardata", () => {
                DataHelper helper = new DataHelper();

                helper.ClearData();

                return 200;
            });

            Handle.GET("/website/resetdata", () => {
                DataHelper helper = new DataHelper();

                helper.ClearData();
                helper.GenerateData();

                return 200;
            });

            Handle.GET("/website/cms", () => {
                return Db.Scope<StandalonePage>(() => {
                    StandalonePage master = this.GetMaster();

                    master.RefreshCurrentPage("/website/partials/cms");

                    return master;
                });
            });

            Handle.GET("/website/cms/templates", () => {
                return Db.Scope<StandalonePage>(() => {
                    StandalonePage master = this.GetMaster();

                    master.RefreshCurrentPage("/website/partials/cms/templates");

                    return master;
                });
            });

            Handle.GET("/website/cms/sections", () => {
                return Db.Scope<StandalonePage>(() => {
                    StandalonePage master = this.GetMaster();

                    master.RefreshCurrentPage("/website/partials/cms/sections");

                    return master;
                });
            });

            Handle.GET("/website/cms/urls", () => {
                return Db.Scope<StandalonePage>(() => {
                    StandalonePage master = this.GetMaster();

                    master.RefreshCurrentPage("/website/partials/cms/urls");

                    return master;
                });
            });

            Handle.GET("/website/cms/maps", () => {
                return Db.Scope<StandalonePage>(() => {
                    StandalonePage master = this.GetMaster();

                    master.RefreshCurrentPage("/website/partials/cms/maps");

                    return master;
                });
            });
        }