示例#1
0
        /// <summary>
        /// 创建 <see cref="CommentPage"/>
        /// </summary>
        /// <param name="currentUserId">当前登录用户 ID</param>
        /// <param name="dbContext"><see cref="KeylolDbContext"/></param>
        /// <param name="cachedData"><see cref="CachedDataProvider"/></param>
        /// <returns><see cref="CommentPage"/></returns>
        public static async Task <CommentPage> CreateAsync(string currentUserId, KeylolDbContext dbContext,
                                                           CachedDataProvider cachedData)
        {
            var messages = await PostOfficeMessageList.CreateAsync(typeof(CommentPage), currentUserId, 1, true,
                                                                   dbContext, cachedData);

            return(new CommentPage
            {
                MessagePageCount = messages.Item2,
                Messages = messages.Item1
            });
        }
示例#2
0
 /// <summary>
 /// 获取评论消息列表
 /// </summary>
 /// <param name="page">分页页码</param>
 /// <param name="dbContext"><see cref="KeylolDbContext"/></param>
 /// <param name="cachedData"><see cref="CachedDataProvider"/></param>
 /// <returns><see cref="PostOfficeMessageList"/></returns>
 public static async Task <PostOfficeMessageList> GetMessages(int page, [Injected] KeylolDbContext dbContext,
                                                              [Injected] CachedDataProvider cachedData)
 {
     return((await PostOfficeMessageList.CreateAsync(typeof(CommentPage), StateTreeHelper.GetCurrentUserId(),
                                                     page, false, dbContext, cachedData)).Item1);
 }