public void Update(int postId) { ContentPost post = postService.GetById(postId, ctx.owner.Id); if (post == null) { echo(lang("exDataNotFound")); return; } ContentValidator.SetPostValue(post, ctx); ContentValidator.ValidateTalk(post, ctx); if (errors.HasErrors) { Edit(postId); } else { post.Title = strUtil.SubString(post.Content, 20); postService.Update(post, ctx.Post("TagList")); echoToParentPart(lang("opok")); HtmlHelper.SetPostToContext(ctx, post); } }
public void Create(int sectionId) { ContentPost post = ContentValidator.Validate(sectionService.GetById(sectionId, ctx.app.Id), ctx); ContentValidator.ValidateTalk(post, ctx); if (errors.HasErrors) { run(Add, sectionId); } else { post.CategoryId = PostCategory.Talk; postService.Insert(post, null); echoToParentPart(lang("opok")); } }
public void Create(int sectionId) { ContentPost post = ContentValidator.SetValueBySection(sectionService.GetById(sectionId, ctx.app.Id), ctx); ContentValidator.ValidateTalk(post, ctx); if (errors.HasErrors) { run(Add, sectionId); } else { post.CategoryId = PostCategory.Talk; post.Title = strUtil.SubString(post.Content, 20); 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.ValidateTalk(post, ctx); if (errors.HasErrors) { Edit(postId); } else { postService.Update(post, null); echoToParentPart(lang("opok")); } }