示例#1
0
        public async Task <ActionResult <ThreadMessage> > PostThread(ThreadMessage message)
        {
            var user = await _userService.ReadUser(message.UserEmail);

            if (user is null)
            {
                return(BadRequest("This user is deleted"));
            }

            return(await this.ExecuteAsync(async() =>
            {
                var threadId = await _service.CreateThread(message, user.Id);

                var thread = await _service.ReadThreadMessage(threadId);
                await _postService.SendMention(message.MessageContext, thread.RoomId);

                await _postService.SendMessage(SignalRMehod.SendThreadMessage, thread);
                return thread;
            }).AsResultAsync());
        }