private ChargeBeeApi() { Addon = new AddonActions(this); Address = new AddressActions(this); Card = new CardActions(this); Comment = new CommentActions(this); Coupon = new CouponActions(this); CouponCode = new CouponCodeActions(this); CreditNote = new CreditNoteActions(this); Customer = new CustomerActions(this); Estimate = new EstimateActions(this); Event = new EventActions(this); HostedPage = new HostedPageActions(this); Invoice = new InvoiceActions(this); Order = new OrderActions(this); PaymentSource = new PaymentSourceActions(this); Plan = new PlanActions(this); PortalSession = new PortalSessionActions(this); ResourceMigration = new ResourceMigrationActions(this); SiteMigrationDetail = new SiteMigrationDetailActions(this); Subscription = new SubscriptionActions(this); TimeMachine = new TimeMachineActions(this); Transaction = new TransactionActions(this); UnbilledCharge = new UnbilledChargeActions(this); }
public async Task <CommentDto> EditComment(CommentDto comment, AuthorType authorType, int userId) { var result = await this._commentRepository.GetCommentById(comment.Id); if (result == null) { result = new Comment() { State = CommentState.Cancelled }; } else { this._commentStateService.CalculateState(result, userId, ActiontType.Edit, authorType); if (result.State == CommentState.Accepted) { result.Message = comment.Message; this._commentRepository.Update(result); var action = new CommentActions() { CommentId = result.Id, Action = ActiontType.Edit, UserId = userId }; this._commentActionsRepository.Add(action); } } return(await Task.FromResult <CommentDto>(TypeAdapterHelper.Adapt <CommentDto>(result))); }
public async Task <bool> DeleteComment(CommentDto comment, AuthorType authorType, int userId) { var operationResult = true; var result = await this._commentRepository.GetCommentById(comment.Id); if (result == null) { result = new Comment() { State = CommentState.Cancelled }; operationResult = false; } else { this._commentStateService.CalculateState(result, userId, ActiontType.Delete, authorType); if (result.State == CommentState.Accepted) { this._commentRepository.Delete(result); var action = new CommentActions() { CommentId = comment.Id, Action = ActiontType.Delete, UserId = userId }; this._commentActionsRepository.Add(action); } } return(await Task.FromResult <bool>(operationResult)); }
public async Task <CommentDto> ReplyToComment(CommentDto comment, AuthorType authorType, int parentId, int userId) { var commentFromDto = TypeAdapterHelper.Adapt <Comment>(comment); var result = await this._commentRepository.GetCommentById(parentId); if (result == null) { commentFromDto = new Comment() { State = CommentState.Cancelled }; } else { this._commentStateService.CalculateState(commentFromDto, userId, ActiontType.Add, authorType); if (commentFromDto.State == CommentState.Accepted) { this._commentRepository.Add(commentFromDto); var action = new CommentActions() { CommentId = commentFromDto.Id, Action = ActiontType.Add, UserId = userId }; this._commentActionsRepository.Add(action); var relatedComment = new RelatedComments() { CommentId = parentId, RelatedCommentId = commentFromDto.Id }; this._relatedCommentsRepository.Add(relatedComment); } } return(await Task.FromResult <CommentDto>(TypeAdapterHelper.Adapt <CommentDto>(commentFromDto))); }
public async Task <CommentDto> AddComment(CommentDto comment, AuthorType authorType, int userId) { var commentFromDto = TypeAdapterHelper.Adapt <Comment>(comment); this._commentStateService.CalculateState(commentFromDto, userId, ActiontType.Add, authorType); if (commentFromDto.State == CommentState.Accepted) { this._commentRepository.Add(commentFromDto); var action = new CommentActions() { CommentId = commentFromDto.Id, Action = ActiontType.Add, UserId = userId }; this._commentActionsRepository.Add(action); } return(await Task.FromResult <CommentDto>(TypeAdapterHelper.Adapt <CommentDto>(commentFromDto))); }