Ejemplo n.º 1
0
        public async Task <ActionResult> AddNewPage_Partial(AddNewPageModel model)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView(model));
            }

            PageDefinition basePage = null;

            if (model.CopyPage)
            {
                basePage = await PageDefinition.LoadAsync(model.CurrentPageGuid);
            }

            PageDefinition.NewPageInfo newPage = await PageDefinition.CreateNewPageAsync(model.Title, model.Description, model.Url, basePage, model.CopyModules);

            PageDefinition page = newPage.Page;

            if (page == null)
            {
                ModelState.AddModelError(nameof(model.Url), newPage.Message);
                return(PartialView(model));
            }

            await page.SaveAsync();

            return(FormProcessed(model, this.__ResStr("okNewPage", "New page created"), NextPage: page.EvaluatedCanonicalUrl));
        }