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)); } }
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")); } }
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); } }
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")); } }
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); } }