示例#1
0
        public ListViewModel(BlogEngineDAL dataaccess, string searchType, int p, string type)
        {
            isHomePage = false;
            PageNo     = p; //page number
            switch (type)
            {
            case "Tag":
                Posts      = dataaccess.PostsForTag(searchType, p - 1, postsCountInHomePage);
                TotalPosts = dataaccess.TotalPostForTag(searchType);
                Tag        = dataaccess.Tag(searchType);
                break;

            case "Category":
                Posts      = dataaccess.PostsForCategory(searchType, p - 1, postsCountInHomePage);
                TotalPosts = dataaccess.TotalPostsForCategory(searchType);
                Category   = dataaccess.Category(searchType);
                break;

            default:
                Posts      = dataaccess.PostsForSearch(searchType, p - 1, postsCountInHomePage);
                TotalPosts = dataaccess.TotalPostsForSearch(searchType);
                Search     = searchType;//search text
                break;
            }
        }