Example #1
0
        public ActionResult _Index(string tabId, int parentId, GridCommand command)
        {
            var serviceResult = ArticleVersionService.List(parentId, command.GetListCommand());
            var result        = Mapper.Map <List <ArticleVersion>, List <ArticleVersionListItem> >(serviceResult);

            return(new TelerikResult(result, result.Count));
        }
Example #2
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 #4
0
        public ActionResult Compare(string tabId, int parentId, int[] IDs, bool?boundToExternal)
        {
            var version = ArticleVersionService.GetMergedVersion(IDs, parentId);
            var model   = ArticleVersionViewModel.Create(version, tabId, parentId, boundToExternal);

            model.ViewType = ArticleVersionViewType.CompareVersions;
            return(JsonHtml("Properties", model));
        }
Example #5
0
        public ActionResult CompareWithCurrent(string tabId, int parentId, int id, bool?boundToExternal)
        {
            var version = ArticleVersionService.GetMergedVersion(new[] { id, ArticleVersion.CurrentVersionId }, parentId);
            var model   = ArticleVersionViewModel.Create(version, tabId, parentId, boundToExternal);

            model.ViewType = ArticleVersionViewType.CompareWithCurrent;
            return(JsonHtml("Properties", model));
        }
        public async Task <ActionResult> Compare(string tabId, int parentId, [FromBody] SelectedItemsViewModel selModel, bool?boundToExternal)
        {
            var version = ArticleVersionService.GetMergedVersion(selModel.Ids, parentId);
            var model   = ArticleVersionViewModel.Create(version, tabId, parentId, boundToExternal);

            model.ViewType = ArticleVersionViewType.CompareVersions;
            return(await JsonHtml("Properties", model));
        }
        public ActionResult _Index(
            string tabId,
            int parentId,
            int page,
            int pageSize,
            string orderBy)
        {
            var listCommand   = GetListCommand(page, pageSize, orderBy);
            var serviceResult = ArticleVersionService.List(parentId, listCommand);
            var result        = Mapper.Map <List <ArticleVersion>, List <ArticleVersionListItem> >(serviceResult);

            return(new TelerikResult(result, result.Count));
        }
Example #8
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));
        }
Example #9
0
        public ActionResult MultipleRemove(int[] IDs, bool?boundToExternal)
        {
            var result = ArticleVersionService.MultipleRemove(IDs, boundToExternal);

            return(JsonMessageResult(result));
        }
Example #10
0
        public ActionResult Remove(int id, bool?boundToExternal)
        {
            var result = ArticleVersionService.Remove(id, boundToExternal);

            return(JsonMessageResult(result));
        }
Example #11
0
        public ActionResult MultipleRemove([FromBody] SelectedItemsViewModel selModel, bool?boundToExternal)
        {
            var result = ArticleVersionService.MultipleRemove(selModel.Ids, boundToExternal);

            return(JsonMessageResult(result));
        }
Example #12
0
 private static PathInfo GetFilePathInfo(int fieldId, int?entityId, bool isVersion) => !isVersion
     ? FieldService.GetPathInfo(fieldId, entityId)
     : ArticleVersionService.GetPathInfo(fieldId, (int)entityId);