示例#1
0
        public void SaveVideo(int sectionId)
        {
            if (shouldApprove(ctx.viewer.obj))
            {
                saveTempPost(sectionId, typeof(ContentVideo));
                if (ctx.HasErrors)
                {
                    echoError();
                }
                return;
            }

            ContentPost post = ContentValidator.SetValueBySection(sectionService.GetById(sectionId, ctx.app.Id), ctx);

            ContentValidator.ValidateVideo(post, ctx);

            if (ctx.HasErrors)
            {
                run(SubmitVideo, sectionId);
            }
            else
            {
                postService.Insert(post, ctx.Post("TagList"));

                echoRedirect("发布成功,谢谢", to(new ContentController().Index));
            }
        }
示例#2
0
        public void Create(int sectionId)
        {
            ContentPost post = ContentValidator.Validate(sectionService.GetById(sectionId, ctx.app.Id), ctx);

            ContentValidator.ValidateVideo(post, ctx);
            if (ctx.HasErrors)
            {
                run(Add, sectionId);
            }
            else
            {
                postService.Insert(post, null);

                echoToParentPart(lang("opok"));
            }
        }
示例#3
0
        public virtual void Create(long sectionId)
        {
            ContentPost post = ContentValidator.SetValueBySection(sectionService.GetById(sectionId, ctx.app.Id), ctx);

            ContentValidator.ValidateVideo(post, ctx);
            if (ctx.HasErrors)
            {
                run(Add, sectionId);
            }
            else
            {
                postService.Insert(post, ctx.Post("TagList"));

                echoToParentPart(lang("opok"));
                HtmlHelper.SetPostToContext(ctx, post);
            }
        }
示例#4
0
        public void Update(int postId)
        {
            ContentPost post = postService.GetById(postId, ctx.owner.Id);

            if (post == null)
            {
                echo(lang("exDataNotFound"));
                return;
            }

            ContentValidator.ValidateEdit(post, ctx);
            ContentValidator.ValidateVideo(post, ctx);
            if (ctx.HasErrors)
            {
                run(Edit, postId);
            }
            else
            {
                postService.Update(post, null);

                echoToParentPart(lang("opok"));
            }
        }
示例#5
0
        public virtual void Update(long postId)
        {
            ContentPost post = postService.GetById(postId, ctx.owner.Id);

            if (post == null)
            {
                echo(lang("exDataNotFound"));
                return;
            }

            ContentValidator.SetPostValue(post, ctx);
            ContentValidator.ValidateVideo(post, ctx);
            if (ctx.HasErrors)
            {
                run(Edit, postId);
            }
            else
            {
                postService.Update(post, ctx.Post("TagList"));

                echoToParentPart(lang("opok"));
                HtmlHelper.SetPostToContext(ctx, post);
            }
        }