示例#1
0
        public async Task <IActionResult> PostMessageAsync([FromBody] MessageModel message)
        {
            int userId = int.Parse(User.Identity.Name);

            message.FromUserId = userId;
            foreach (var reply in message.Replies)
            {
                reply.UserId = userId;
            }

            message = await messagesRepository.AddMessageAsync(message);

            await discordService.SendMessageAsync(message.Id, Request.Headers["Origin"]);

            return(Ok(message));
        }