public CommentsViewModel Execute(CommentsInputModel inputModel) { return new CommentsViewModel { Comments = _session.Query<CommentViewModel>() .Where(x => x.ArticleUri.Equals(inputModel.Uri)) .OrderByDescending(x => x.PublishedDate) }; }
public CommentsViewModel Execute(CommentsInputModel inputModel) { var comments = _database .Query <Comment>() .Where(x => x.ArticleUri.Equals(inputModel.Uri)) .OrderByDescending(x => x.PublishedDate) .ToList(); return(new CommentsViewModel { Uri = inputModel.Uri, Comments = comments.Select(x => x.DynamicMap <CommentViewModel>()) }); }