Ejemplo n.º 1
0
        public ActionResult AddFolder(EditNodePageModel model)
        {
            if (model is null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            if (model.BaseUrl is null)
            {
                throw new NullReferenceException(NULL_BASE_URL_MESSAGE);
            }

            if (model.Page?.Url is null)
            {
                throw new NullReferenceException(NULL_PAGE_URL_MESSAGE);
            }

            using (IWriteContext writeContext = this.PageRepository.WriteContext())
            {
                Page thisPage = new Page
                {
                    Url = Path.Combine(model.BaseUrl, model.Page.Url).Replace('\\', '/')
                };

                this.PageRepository.AddOrUpdate(thisPage);
            }

            return(this.Redirect("/Admin/Page/Index"));
        }
Ejemplo n.º 2
0
        public ActionResult EditNode(EditNodePageModel model)
        {
            if (model is null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            if (model.Page is null)
            {
                throw new NullReferenceException(NULL_PAGE_MESSAGE);
            }

            using (IWriteContext writeContext = this.PageRepository.WriteContext())
            {
                Page thisPage = this.PageRepository.Find(model.Page._Id);

                thisPage.Content = model.Page.Content;

                thisPage.Type = model.Page.Type;

                thisPage.Url = model.Page.Url;

                thisPage.Cascade = model.Page.Cascade;

                thisPage.Layout = model.Page.Layout;

                thisPage.Parameters = model.Page.Parameters;

                this.PageRepository.AddOrUpdate(thisPage);
            }

            return(this.Redirect("/Admin/Page/Index"));
        }
Ejemplo n.º 3
0
        public ActionResult AddPage(EditNodePageModel model)
        {
            if (model is null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            if (model.BaseUrl is null)
            {
                throw new NullReferenceException(NULL_BASE_URL_MESSAGE);
            }

            if (model.Page?.Url is null)
            {
                throw new NullReferenceException(NULL_PAGE_URL_MESSAGE);
            }

            using (IWriteContext writeContext = this.PageRepository.WriteContext())
            {
                model.Page.Url = Path.Combine(model.BaseUrl, model.Page.Url ?? "").Replace("\\", "/", StringComparison.OrdinalIgnoreCase);

                this.PageRepository.AddOrUpdate(model.Page);
            }

            return(this.Redirect("/Admin/Page/Index"));
        }
Ejemplo n.º 4
0
        public ActionResult AddPage(string Url)
        {
            EditNodePageModel model = new EditNodePageModel(Url)
            {
                Macros = new MacroService(this.ServiceProvider).GetMacros(null)
            };

            return(this.View("EditNode", model));
        }
Ejemplo n.º 5
0
        public ActionResult EditNode(string Url)
        {
            EditNodePageModel model = new EditNodePageModel(Url, this.PageRepository.GetByUrl(Url));

            if (model.Page is null)
            {
                throw new NullReferenceException(NULL_PAGE_MESSAGE);
            }

            model.Modules = this.ComponentService.GetComponents <ViewModule, Entity>(model.Page).ToList();

            if (Page.GetPageType(Url) == Page.PageType.CSS)
            {
                return(this.View("EditCSS", model));
            }
            else if (Page.GetPageType(Url) == Page.PageType.JS)
            {
                return(this.View("EditJS", model));
            }

            model.Macros = new MacroService(this.ServiceProvider).GetMacros(model.Page);

            return(this.View(model));
        }
Ejemplo n.º 6
0
        public ActionResult AddJS(string Url)
        {
            EditNodePageModel model = new EditNodePageModel(Url, this.PageRepository.GetByUrl(Url));

            return(this.View(model));
        }
Ejemplo n.º 7
0
        public ActionResult AddFolder(string Url)
        {
            EditNodePageModel model = new EditNodePageModel(Url);

            return(this.View(model));
        }