forked from wojilu/wojilu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NormalController.cs
executable file
·61 lines (45 loc) · 1.84 KB
/
NormalController.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
/*
* Copyright (c) 2010, www.wojilu.com. All rights reserved.
*/
using System;
using System.Collections.Generic;
using wojilu.Web.Mvc;
using wojilu.Web.Mvc.Attr;
using wojilu.Common.AppBase.Interface;
using wojilu.Apps.Content.Interface;
using wojilu.Apps.Content.Service;
using wojilu.Apps.Content.Enum;
using wojilu.Apps.Content.Domain;
using wojilu.Web.Controller.Content.Utils;
using wojilu.Common.AppBase;
namespace wojilu.Web.Controller.Content.Section {
[App( typeof( ContentApp ) )]
public partial class NormalController : ControllerBase, IPageSection {
public virtual IContentPostService postService { get; set; }
public virtual IContentImgService imgService { get; set; }
public virtual IContentSectionService sectionService { get; set; }
public NormalController() {
postService = new ContentPostService();
imgService = new ContentImgService();
sectionService = new ContentSectionService();
}
public virtual void SectionShow( long sectionId ) {
ContentSection s = sectionService.GetById( sectionId, ctx.app.Id );
if (s == null) {
throw new Exception( lang( "exDataNotFound" ) + "=>page section:" + sectionId );
}
long appId = ctx.app.Id;
int postcat = PostCategory.Post;
int imgcat = PostCategory.Img;
List<ContentPost> posts = this.postService.GetTopBySectionAndCategory( sectionId, postcat );
ContentPost img = this.imgService.GetTopImg( sectionId, imgcat, appId );
bindSectionShow( posts, img );
}
public virtual void List( long sectionId ) {
run( new ListController().List, sectionId );
}
public virtual void Show( long id ) {
run( new ListController().Show, id );
}
}
}