forked from wojilu/wojilu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LayoutController.cs
executable file
·74 lines (50 loc) · 2.26 KB
/
LayoutController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* Copyright (c) 2010, www.wojilu.com. All rights reserved.
*/
using System;
using System.Collections.Generic;
using wojilu.Web.Mvc;
using wojilu.Common.Comments;
using wojilu.Apps.Blog.Domain;
using wojilu.Apps.Blog.Interface;
using wojilu.Apps.Blog.Service;
using wojilu.Caching;
using wojilu.Web.Context;
using wojilu.Members.Users.Domain;
using wojilu.Web.Controller.Blog.Caching;
using wojilu.Web.Controller.Common.Caching;
using wojilu.Web.Mvc.Attr;
namespace wojilu.Web.Controller.Blog {
public partial class LayoutController : ControllerBase {
public IBlogService blogService { get; set; }
public IBlogCategoryService categoryService { get; set; }
public ICommentService<BlogPostComment> commentService { get; set; }
public IBlogPostService postService { get; set; }
public IBlogrollService rollService { get; set; }
public LayoutController() {
blogService = new BlogService();
postService = new BlogPostService();
categoryService = new BlogCategoryService();
rollService = new BlogrollService();
commentService = new CommentService<BlogPostComment>();
}
[CacheAction( typeof( BlogLayoutCache ) )]
public override void Layout() {
BlogApp blog = ctx.app.obj as BlogApp;
blogService.AddHits( blog );
set( "adminUrl", to( new Admin.MyListController().Index ) );
bindAppInfo( blog );
load( "blog.UserMenu", new Users.ProfileController().UserMenu );
BlogSetting s = blog.GetSettingsObj();
List<BlogCategory> categories = categoryService.GetByApp( ctx.app.Id );
List<BlogPost> newBlogs = postService.GetNewBlog( ctx.app.Id, s.NewBlogCount );
//List<BlogPostComment> newComments = commentService.GetNew( ctx.owner.Id, ctx.app.Id, s.NewCommentCount );
List<BlogPostComment> newComments = BlogPostComment.find( "AppId=" + ctx.app.Id ).list( s.NewCommentCount );
List<Blogroll> blogrolls = rollService.GetByApp( ctx.app.Id, ctx.owner.obj.Id );
bindBlogroll( blogrolls );
bindCategories( categories );
bindPostList( newBlogs );
bindComments( newComments );
}
}
}