コード例 #1
0
        public async Task <IBlogCommentData> GetBlogCommentAsync(string blogId, string commentId)
        {
            var partitionKey = BlogCommentEntity.GeneratePartitionKey(blogId);
            var rowKey       = BlogCommentEntity.GenerateRowKey(commentId);

            return(await _blogCommentsTableStorage.GetDataAsync(partitionKey, rowKey));
        }
コード例 #2
0
        public async Task DeleteAsync(string blogId, string commentId)
        {
            var partitionKey = BlogCommentEntity.GeneratePartitionKey(blogId);
            var rowKey       = BlogCommentEntity.GenerateRowKey(commentId);

            await _blogCommentsTableStorage.DeleteAsync(partitionKey, rowKey);
        }
コード例 #3
0
        public Task UpdateAsync(IBlogCommentData blogCommentData, string blogId = null)
        {
            var partitionKey = blogId == null?BlogCommentEntity.GeneratePartitionKey(blogCommentData.BlogId) : BlogCommentEntity.GeneratePartitionKey(blogId);

            var rowKey = BlogCommentEntity.GenerateRowKey(blogCommentData.Id);

            return(_blogCommentsTableStorage.ReplaceAsync(partitionKey, rowKey, itm =>
            {
                itm.Update(blogCommentData);
                return itm;
            }));
        }
コード例 #4
0
        public static BlogCommentEntity Create(IBlogCommentData src)
        {
            var id     = Guid.NewGuid().ToString("N");
            var result = new BlogCommentEntity
            {
                PartitionKey = GeneratePartitionKey(src.BlogId),
                RowKey       = GenerateRowKey(id),
                BlogId       = GeneratePartitionKey(src.BlogId),
                Id           = id,
                Comment      = src.Comment,
                UserId       = src.UserId,
                FullName     = src.FullName,
                Created      = src.Created,
                LastModified = src.LastModified,
                ParentId     = src.ParentId,
                UserAgent    = src.UserAgent
            };

            return(result);
        }
コード例 #5
0
        public async Task <IEnumerable <IBlogCommentData> > GetBlogCommentsAsync(string blogId)
        {
            var partitionKey = BlogCommentEntity.GeneratePartitionKey(blogId);

            return(await _blogCommentsTableStorage.GetDataAsync(partitionKey));
        }
コード例 #6
0
 public async Task SaveAsync(IBlogCommentData blogCommentData)
 {
     var newEntity = BlogCommentEntity.Create(blogCommentData);
     await _blogCommentsTableStorage.InsertAsync(newEntity);
 }