Example #1
0
        public ActionResult Unmoderated(string subName)
        {
            if (string.IsNullOrEmpty(subName))
            {
                throw new NotFoundException();
            }

            var sub = _subDao.GetSubByName(subName);

            if (sub == null)
            {
                throw new NotFoundException();
            }

            var postIds = _postDao.GetUnmoderatedPosts(new List <Guid> {
                sub.Id
            }, take: 30);

            var model = new SubPostsModel();

            model.Sub    = _subWrapper.Wrap(sub.Id, _userContext.CurrentUser);
            model.SortBy = PostsSortBy.New;
            model.Posts  = new PagedList <PostWrapped>(_postWrapper.Wrap(postIds, _userContext.CurrentUser), 0, 30, postIds.HasMore);

            return(View(model));
        }