コード例 #1
0
        public async Task <IEnumerable <CommentView <TUserView> > > GetComments(TUser account, int newsId, bool descending = false)
        {
            var news = await session.LoadAsync <TThread>(newsId);

            var comments = (await session.SelectAllFrom <TCommentInThread>(x => x.Comment, x => x.Comment.Author).Where(c => c.Commentable == news).ToListAsync()).Select(x => x.Comment);

            if (descending)
            {
                return(comments.OrderByDescending(c => c.CreationDate).Select(c => commentMapping.ToCommentView(c)));
            }

            return(comments.OrderBy(c => c.CreationDate).Select(c => commentMapping.ToCommentView(c)));
        }
コード例 #2
0
 public async Task <CommentView <TUserView> > Get(int id)
 {
     return(forumsDataMapping.ToCommentView(await session.LoadAsync <Comment <TUser> >(id)));
 }