Пример #1
0
        public virtual ActionResult CrossPageSort(ContentSorter sourceContent, string folderName, int? page, int? pageSize, bool up = true)
        {
            var entry = new JsonResultEntry();
            try
            {
                //page = page ?? 1;
                //pageSize = pageSize ?? 50;
                var textFolder = new TextFolder(Repository, folderName);
                var content = new TextFolder(Repository, folderName).CreateQuery().WhereEquals("UUID", sourceContent.UUID).FirstOrDefault();

                TextContent destContent;
                if (up)
                {
                    destContent = content.Previous();
                }
                else
                {
                    destContent = content.Next();
                }
                if (destContent != null)
                {
                    ServiceFactory.TextContentManager.Update(textFolder, sourceContent.UUID, "Sequence", destContent["Sequence"], User.Identity.Name);
                    ServiceFactory.TextContentManager.Update(textFolder, destContent.UUID, "Sequence", content["Sequence"], User.Identity.Name);
                }
            }
            catch (Exception e)
            {
                entry.AddException(e);
            }
            return Json(entry);
        }
Пример #2
0
        public virtual ActionResult CrossPageSort(ContentSorter sourceContent, string folderName, int? page, int? pageSize, bool up = true)
        {
            var data = new JsonResultData(ModelState);
            data.RunWithTry((resultData) =>
            {
                var textFolder = new TextFolder(Repository, folderName);
                var content = new TextFolder(Repository, folderName).CreateQuery().WhereEquals("UUID", sourceContent.UUID).FirstOrDefault();

                TextContent destContent;
                if (up)
                {
                    destContent = content.Previous();
                }
                else
                {
                    destContent = content.Next();
                }
                if (destContent != null)
                {
                    TextContentManager.Update(textFolder, sourceContent.UUID, "Sequence", destContent["Sequence"], User.Identity.Name);
                    TextContentManager.Update(textFolder, destContent.UUID, "Sequence", content["Sequence"], User.Identity.Name);
                }
            });
            return Json(data);
        }