示例#1
0
 public PostViewModel(PostHandler _post, string search, int page, int pageLimit)
     : base(_post, page, pageLimit)
 {
     Posts = _post.PostsForSearch(search, page - 1, pageLimit);
     TotalPostsForPage = Posts.Count;
     TotalPosts = _post.TotalPostsForSearch(search);
 }
示例#2
0
 public PostViewModel(PostHandler _post, int page, int pageLimit)
     : base(_post, page, pageLimit)
 {
     Posts = _post.PostsForPage(page - 1, pageLimit);
     TotalPostsForPage = Posts.Count;
     TotalPosts = _post.TotalPosts();
 }
示例#3
0
 public TagViewModel(TagHandler _tag, string tagSlug, PostHandler _post, int page, int pageLimit)
     : base(_post, page, pageLimit)
 {
     Tag = _tag.Tag(tagSlug);
     Posts = _post.PostsForTag(tagSlug, page - 1, pageLimit);
     TotalPosts = _post.TotalPostsForTag(tagSlug);
     TotalPostsForPage = Posts.Count;
 }
示例#4
0
 public CategoryViewModel(CategoryHandler _category, string categorySlug, PostHandler _post, int page, int pageLimit)
     : base(_post, page, pageLimit)
 {
     Posts = _post.PostsForCategory(categorySlug, page - 1, pageLimit);
     TotalPosts = _post.TotalPostsForCategory(categorySlug);
     Category = _category.Category(categorySlug);
     TotalPostsForPage = Posts.Count;
 }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            handler = new PostHandler();

            if (!string.IsNullOrEmpty((string)Session["StatusMessage"]))
            {
                string message = (string)Session["StatusMessage"];
                Session["StatusMessage"] = null;
                MessageLabel.Visible = true;
                MessageLabel.Text = message;
            }
        }
示例#6
0
        static void Main(string[] args)
        {
            logger.Debug("Application start");

            CategoryHandler catHandler = new CategoryHandler();

            IList<Category> categories = catHandler.Categories();
            foreach (var category in categories)
                Console.WriteLine(category.Id + ". " + category.Name);

            CommentHandler comHandler = new CommentHandler();

            IList<Comment> comments = comHandler.UserComments(1);
            foreach (var comment in comments)
                Console.WriteLine(comment.Id + ". " + comment.Text);

            PostHandler postHandler = new PostHandler();

            IList<Post> posts = postHandler.Posts();
            foreach (var post in posts)
                Console.WriteLine(post.Id + ". " + post.Comments.Count + "  " + post.PostedOn.ToShortDateString());

            TagHandler tagHandler = new TagHandler();

            IList<Tag> tags = tagHandler.Tags();
            foreach (var tag in tags)
                Console.WriteLine(tag.Name);

            UserHandler userHandler = new UserHandler();

            IList<User> users = userHandler.AuthorUsers();
            foreach (var user in users)
                Console.WriteLine(user.Id + ". " + user.Login + " " + user.Password);

            logger.Debug("Application loaded succesfully");

            Console.ReadLine();
        }
示例#7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     postHandler = new PostHandler();
     commentHandler = new CommentHandler();
 }
示例#8
0
 public CategoryController()
 {
     _category = new CategoryHandler();
     _post = new PostHandler();
 }
示例#9
0
 public PostController()
 {
     _post = new PostHandler();
 }
示例#10
0
 public InfoController()
 {
     _post = new PostHandler();
 }
示例#11
0
 public TagsController()
 {
     _tag = new TagHandler();
     _post = new PostHandler();
 }
示例#12
0
 public BaseViewModel(PostHandler _post, int page, int pageLimit)
 {
     PageLimit = pageLimit;
 }