public virtual async Task <CommentDto> CreateAsync(CreateCommentInput input) { var user = await CmsUserLookupService.FindByIdAsync(CurrentUser.GetId()); if (user == null) { throw new BusinessException(message: "User Not found!"); } var comment = await CommentRepository.InsertAsync(new Comment( GuidGenerator.Create(), input.EntityType, input.EntityId, input.Text, input.RepliedCommentId, user.Id, CurrentTenant.Id )); return(ObjectMapper.Map <Comment, CommentDto>(comment)); }
public Task <CommentDto> CreateAsync(CreateCommentInput input) { return(CommentPublicAppService.CreateAsync(input)); }
public virtual async Task <CommentDto> CreateAsync(string entityType, string entityId, CreateCommentInput input) { var user = await CmsUserLookupService.GetByIdAsync(CurrentUser.GetId()); if (input.RepliedCommentId.HasValue) { await CommentRepository.GetAsync(input.RepliedCommentId.Value); } var comment = await CommentRepository.InsertAsync( new Comment( GuidGenerator.Create(), entityType, entityId, input.Text, input.RepliedCommentId, user.Id, CurrentTenant.Id ) ); await UnitOfWorkManager.Current.SaveChangesAsync(); await DistributedEventBus.PublishAsync(new CreatedCommentEvent { Id = comment.Id }); return(ObjectMapper.Map <Comment, CommentDto>(comment)); }
public Task <CommentDto> CreateAsync(string entityType, string entityId, CreateCommentInput input) { return(CommentPublicAppService.CreateAsync(entityType, entityId, input)); }
public virtual async Task <CommentDto> CreateAsync(string entityType, string entityId, CreateCommentInput input) { var user = await CmsUserLookupService.GetByIdAsync(CurrentUser.GetId()); var comment = await CommentRepository.InsertAsync( new Comment( GuidGenerator.Create(), entityType, entityId, input.Text, input.RepliedCommentId, user.Id, CurrentTenant.Id ) ); return(ObjectMapper.Map <Comment, CommentDto>(comment)); }