public async Task <IActionResult> StartConversation(StartConversationRequest model,
                                                            CancellationToken token)
        {
            var command = new SendChatTextMessageCommand(model.Message, model.UserId,
                                                         model.TutorId);
            await _commandBus.DispatchAsync(command, token);

            return(Ok());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PostAsync([FromBody] ChatMessageRequest model, CancellationToken token)
        {
            var userId = _userManager.GetLongUserId(User);

            if (userId == model.OtherUser)
            {
                return(BadRequest());
            }
            var command = new SendChatTextMessageCommand(model.Message, userId, model.OtherUser);
            await _commandBus.DispatchAsync(command, token);

            return(Ok());
        }