public void List() { ForumApp app = ctx.app.obj as ForumApp; set("recentTopicLink", to(new RecentController().Topic)); set("recentPostLink", to(new RecentController().Post)); set("recentHotLink", to(new RecentController().Replies)); set("recentPickedImgLink", to(new RecentController().ImgTopic)); ForumSetting s = app.GetSettingsObj(); List <ForumPickedImg> pickedImg = ForumPickedImg.find("AppId=" + ctx.app.Id).list(s.HomeImgCount); bindImgs(pickedImg); List <ForumTopic> newPosts = topicService.GetByApp(ctx.app.Id, s.HomeListCount); bindTopics(newPosts, "topic"); List <ForumTopic> hots = topicService.GetByAppAndReplies(ctx.app.Id, s.HomeListCount, s.HomeHotDays); bindTopics(hots, "hot"); List <ForumPost> posts = postService.GetRecentByApp(ctx.app.Id, s.HomeListCount); bindPosts(posts, "post"); }
public void Delete(int id) { ForumPickedImg f = ForumPickedImg.findById(id); if (f == null) { echo(lang("exDataNotFound")); return; } f.delete(); redirect(Index); }
public void Edit(int id) { target(Update, id); ForumPickedImg f = ForumPickedImg.findById(id); if (f == null) { echo(lang("exDataNotFound")); return; } bind("f", f); }
public void ImgTopic() { DataPage <ForumPickedImg> list = ForumPickedImg.findPage("AppId=" + ctx.app.Id); IBlock block = getBlock("list"); foreach (ForumPickedImg f in list.Results) { block.Set("f.Id", f.Id); block.Set("f.Title", f.Title); block.Set("f.Url", f.Url); block.Set("f.ImgUrl", f.ImgUrl); block.Set("f.Created", f.Created); block.Next(); } set("page", list.PageBar); }
public void Create() { ForumPickedImg f = ctx.PostValue <ForumPickedImg>(); f.AppId = ctx.app.Id; f.Creator = ctx.viewer.obj as User; Result result = f.insert(); if (result.HasErrors) { run(Add); } else { echoToParentPart(lang("opok")); } }
public void Index() { set("addUrl", to(Add)); DataPage <ForumPickedImg> list = ForumPickedImg.findPage("AppId=" + ctx.app.Id); IBlock block = getBlock("list"); foreach (ForumPickedImg f in list.Results) { block.Set("f.Id", f.Id); block.Set("f.Title", f.Title); block.Set("f.Url", f.Url); block.Set("f.ImgUrl", f.ImgUrl); block.Set("f.Created", f.Created); block.Set("f.EditLink", to(Edit, f.Id)); block.Set("f.DeleteLink", to(Delete, f.Id)); block.Next(); } set("page", list.PageBar); }
public void Update(int id) { ForumPickedImg f = ForumPickedImg.findById(id); if (f == null) { echo(lang("exDataNotFound")); return; } f = ctx.PostValue(f) as ForumPickedImg; Result result = f.update(); if (result.HasErrors) { run(Add); } else { echoToParentPart(lang("opok")); } }