Esempio n. 1
0
        private ICommandHandlingResult HandleInternal(CreateOrUpdateMessageCommand command)
        {
            if (String.IsNullOrEmpty(command.UserId))
            {
                //todo log
                return(ValidationFail(nameof(command.UserId)));
            }

            if (String.IsNullOrEmpty(command.ChannelName))
            {
                return(ValidationFail(nameof(command.ChannelName)));
            }

            var user    = _userService.Get(command.UserId);
            var channel = _channelService.Get(command.ChannelName);

            var message = new Message(command.Timestamp, command.Text, false, user, channel);

            _messageGeneratorService.CreateOrUpdate(message);

            return(CommandHandlingResult.Success());
        }