Ejemplo n.º 1
0
        public async Task Handle(UserCreatedEvent notification, CancellationToken cancellationToken)
        {
            var text    = "Welcome";
            var command = new CreateMessageCommand.Command(notification.UserId, text);

            await _mediator.Send(command);
        }
        public async Task <ActionResult <CreateMessageCommand.Result> > CreateUserMessage([FromRoute] Guid userId, [FromBody] CreateUserMessageRequest request)
        {
            var command = new CreateMessageCommand.Command(userId, request?.Text);

            var result = await _commandBus.Send(command);

            return(Ok(result));
        }