Пример #1
0
        public void Update(int id)
        {
            ForumPost post = postService.GetById(id, ctx.owner.obj);

            if (post == null)
            {
                echo(alang("exPostNotFound"));
                return;
            }

            ForumBoard board = boardService.GetById(post.ForumBoardId, ctx.owner.obj);

            if (PermissionUtil.IsSelfEdit(ctx, post) == false)
            {
                if (!PermissionUtil.Check(this, board))
                {
                    return;
                }
            }

            post = ForumValidator.ValidatePostEdit(post, ctx);
            if (errors.HasErrors)
            {
                run(Edit, id);
            }
            else
            {
                postService.Update(post, (User)ctx.viewer.obj);

                new ForumCacheRemove(boardService, topicService, this).UpdatePost(post);

                echoToParent(lang("opok"));
            }
        }
Пример #2
0
        public virtual void Update(long id)
        {
            ForumPost  post  = postService.GetById(id, ctx.owner.obj);
            ForumBoard board = boardService.GetById(post.ForumBoardId, ctx.owner.obj);

            post = ForumValidator.ValidatePostEdit(post, ctx);
            if (errors.HasErrors)
            {
                run(Edit, id);
            }
            else
            {
                postService.Update(post, (User)ctx.viewer.obj);

                String parentUrl = getTopicLastPage(post);
                echoToParent(lang("opok"), parentUrl);
            }
        }