Esempio n. 1
0
        public ActionResult User(string userName)
        {
            ViewBag.NavigationKey = "overview";

            var model = BuildUserModel(userName);

            var latestComments = _commentDao.GetCommentsForUser(model.User.Id,
                                                                sortBy: CommentSortBy.New,
                                                                timeFilter: CommentsTimeFilter.All,
                                                                skip: 0,
                                                                take: 3);

            model.Comments = new PagedList <CommentWrapped>(
                _commentWrapper.Wrap(latestComments, _userContext.CurrentUser),
                0,
                5,
                true);

            var latestPosts = _postDao.GetPosts(
                userId: model.User.Id,
                sortby: PostsSortBy.New,
                timeFilter: PostsTimeFilter.All,
                nsfw: _userContext.CurrentNsfw,
                skip: 0,
                take: 3);

            model.Posts = new PagedList <PostWrapped>(
                _postWrapper.Wrap(latestPosts, _userContext.CurrentUser),
                0,
                5,
                true);

            return(View(model));
        }
Esempio n. 2
0
        // TODO: [ChildActionOnly]
        public ActionResult AnnouncementPosts()
        {
            if (!_announcementSubId.HasValue)
            {
                var announcementSub = _subDao.GetSubByName("announcements");
                _announcementSubId = announcementSub != null ? announcementSub.Id : Guid.Empty;
            }

            if (_announcementSubId == Guid.Empty)
            {
                return(Content(""));
            }

            var sticky = _postDao.GetPosts(new List <Guid> {
                _announcementSubId.Value
            }, sticky: true);

            var posts = _postWrapper.Wrap(sticky, _userContext.CurrentUser);

            return(PartialView("PostList", posts));
        }