public async Task <ICommentData> GetCommentAsync(string projectId, string commentId)
        {
            var partitionKey = CommentEntity.GeneratePartitionKey(projectId);
            var rowKey       = CommentEntity.GenerateRowKey(commentId);

            return(await _projectCommentsTableStorage.GetDataAsync(partitionKey, rowKey));
        }
        public async Task DeleteAsync(string projectId, string commentId)
        {
            var partitionKey = CommentEntity.GeneratePartitionKey(projectId);
            var rowKey       = CommentEntity.GenerateRowKey(commentId);

            await _projectCommentsTableStorage.DeleteAsync(partitionKey, rowKey);
        }
        public Task UpdateAsync(ICommentData projectCommentData)
        {
            var partitionKey = CommentEntity.GeneratePartitionKey(projectCommentData.ProjectId);
            var rowKey       = CommentEntity.GenerateRowKey(projectCommentData.Id);

            return(_projectCommentsTableStorage.ReplaceAsync(partitionKey, rowKey, itm =>
            {
                itm.Update(projectCommentData);
                return itm;
            }));
        }
        public static CommentEntity Create(ICommentData src)
        {
            var id     = Guid.NewGuid().ToString("N");
            var result = new CommentEntity
            {
                PartitionKey = GeneratePartitionKey(src.ProjectId),
                RowKey       = GenerateRowKey(id),
                Id           = id,
                Comment      = src.Comment,
                UserId       = src.UserId,
                FullName     = src.FullName,
                Created      = src.Created,
                LastModified = src.LastModified,
                ParentId     = src.ParentId
            };

            return(result);
        }
        public async Task <IEnumerable <ICommentData> > GetProjectCommentsAsync(string projectId)
        {
            var partitionKey = CommentEntity.GeneratePartitionKey(projectId);

            return(await _projectCommentsTableStorage.GetDataAsync(partitionKey));
        }
 public async Task SaveAsync(ICommentData projectCommentData)
 {
     var newEntity = CommentEntity.Create(projectCommentData);
     await _projectCommentsTableStorage.InsertAsync(newEntity);
 }