Example #1
0
        public ActionResult Properties(string tabId, int parentId, int id, string successfulActionCode, bool?boundToExternal)
        {
            var version = ArticleVersionService.Read(id, parentId);
            var model   = ArticleVersionViewModel.Create(version, tabId, parentId, successfulActionCode, boundToExternal);

            return(JsonHtml("Properties", model));
        }
        public async Task <ActionResult> Properties(string tabId, int parentId, int id, string backendActionCode, bool?boundToExternal, IFormCollection collection)
        {
            var version0 = ArticleVersionService.Read(id, parentId);
            var article  = ArticleService.ReadForUpdate(version0.ArticleId, version0.Article.ContentId);
            var version  = ArticleVersionService.CreateVersionFromArticle(article);

            version.Id = ArticleVersion.CurrentVersionId; // for proper loading aggregated articles
            var model = ArticleVersionViewModel.Create(version, tabId, parentId, boundToExternal);

            await TryUpdateModelAsync(model);

            if (ModelState.IsValid)
            {
                model.Data.Article = ArticleVersionService.Restore(model.Data, boundToExternal, HttpContext.IsXmlDbUpdateReplayAction());
                return(Redirect("Properties", new
                {
                    tabId,
                    parentId,
                    id,
                    successfulActionCode = backendActionCode,
                    boundToExternal
                }));
            }

            return(await JsonHtml("Properties", model));
        }
Example #3
0
        public ActionResult Properties(string tabId, int parentId, int id, string backendActionCode, bool?boundToExternal, FormCollection collection)
        {
            var version = ArticleVersionService.Read(id);
            var model   = ArticleVersionViewModel.Create(version, tabId, parentId, boundToExternal);

            TryUpdateModel(model);
            model.Validate(ModelState);

            if (ModelState.IsValid)
            {
                model.Data.Article = ArticleVersionService.Restore(model.Data, boundToExternal, HttpContext.IsXmlDbUpdateReplayAction());
                return(Redirect("Properties", new
                {
                    tabId,
                    parentId,
                    id,
                    successfulActionCode = backendActionCode,
                    boundToExternal
                }));
            }

            return(JsonHtml("Properties", model));
        }