Esempio n. 1
0
        /// <summary>
        /// 判断用户是否收藏了Blog
        /// </summary>
        /// <param name="personId">PersonID</param>
        /// <param name="blogId">BlogID</param>
        /// <returns></returns>
        public async Task<bool> IsFavoriteAsync(long personId, long blogId)
        {
            using (KoalaBlogDbContext dbContext = new KoalaBlogDbContext())
            {
                FavoriteHandler favoriteHandler = new FavoriteHandler(dbContext);

                return await favoriteHandler.IsFavoriteAsync(personId, blogId);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 获取Blog收藏的数量
        /// </summary>
        /// <param name="blogId">BlogID</param>
        /// <returns></returns>
        public async Task<int> GetFavoriteCountAsync(long blogId)
        {
            using (KoalaBlogDbContext dbContext = new KoalaBlogDbContext())
            {
                FavoriteHandler favoriteHandler = new FavoriteHandler(dbContext);

                return await favoriteHandler.GetFavoriteCountAsync(blogId);
            }
        }