Ejemplo n.º 1
0
        public IActionResult CreateSitePage(SitePageManagementCreateModel model)
        {
            if (!this.ModelState.IsValid)
            {
                throw new Exception();
            }

            var title = model.Title.Trim();
            var entry = this.sitePageRepository.Create(new SitePage()
            {
                Title              = title,
                Key                = title.UrlKey(),
                PageHeader         = title,
                BreadcrumbName     = title,
                PublishDateTimeUtc = DateTime.UtcNow,
                SitePageSectionId  = model.SiteSectionId,
                CreatedByUserId    = this.userManager.GetUserId(this.User)
            });

            if (entry.SitePageId > 0)
            {
                return(this.RedirectToAction(nameof(this.EditSitePage), new { SitePageId = entry.SitePageId }));
            }
            else
            {
                return(this.View(entry));
            }
        }
Ejemplo n.º 2
0
        public IActionResult CreateSitePage(int sitePageSectionId)
        {
            var model = new SitePageManagementCreateModel()
            {
                SiteSectionId = sitePageSectionId
            };

            return(this.View(model));
        }