Ejemplo n.º 1
0
        private async Task <object> ProcessSocketMessage(SocketMessage <MessageRequest> socketMessage, Models.User authorizedUser)
        {
            var command = socketMessage.GetObject();

            RequireNotEmptyContent(command);
            RequireOnlyOneId(command);

            Documents.Message message;

            if (command.ChatId != Guid.Empty)
            {
                message = await _chatMessageService.AddMessageToChatAsync(command.ChatId, command.Content, authorizedUser);
            }
            else
            {
                message = await _channelMessageService.AddMessageToChannelAsync(command.ChannelId, command.Content, authorizedUser);
            }

            return(message);
        }