public ChatViewModel(INavigationService navigationService,
                             IRepository <Message> messageRepository,
                             ChatbotViewModel chatbotViewModel,
                             ICommandFactory commandFactory,
                             IDialogService dialogService,
                             IQueryFactory queryFactory,
                             ChatBoxViewModel message)
            : base(navigationService)
        {
            Guard.Against.Null(navigationService, nameof(navigationService));
            Guard.Against.Null(messageRepository, nameof(messageRepository));
            Guard.Against.Null(chatbotViewModel, nameof(chatbotViewModel));
            Guard.Against.Null(commandFactory, nameof(commandFactory));
            Guard.Against.Null(dialogService, nameof(dialogService));
            Guard.Against.Null(queryFactory, nameof(queryFactory));
            Guard.Against.Null(message, nameof(message));

            ChatbotViewModel = chatbotViewModel;
            _dialogService   = dialogService;
            Messages         = messageRepository;
            ChatBoxViewModel = message;

            Title       = "Chat Page";
            SendMessage = commandFactory
                          .MakeDelegateWithParameter <SendMessageCommand, IChatBoxModel>();

            GotoOptions       = new DelegateCommand(GotoOptionsCommand);
            _getMessagesQuery = queryFactory.MakeQuery <GetMessagesQuery>();
        }
        public void Add(ChatbotViewModel chatbotViewModel)
        {
            var addCommand = new AddChatbotCommand(chatbotViewModel.Id, chatbotViewModel.Name,
                                                   chatbotViewModel.Description, chatbotViewModel.DiscordExported, chatbotViewModel.MessengerExported,
                                                   chatbotViewModel.DiscordBotSecret, _mapper.Map <List <Dialogue> >(chatbotViewModel.Dialogues),
                                                   _mapper.Map <User>(chatbotViewModel.User), chatbotViewModel.CreatedDate);


            //var addCommand = _mapper.Map<AddChatbotCommand>(chatbotViewModel);
            Bus.SendCommand(addCommand);
        }
        public IActionResult Put([FromBody] ChatbotViewModel chatbotViewModel)
        {
            if (!ModelState.IsValid)
            {
                NotifyModelStateErrors();
                return(Response(chatbotViewModel));
            }

            _chatbotAppService.Update(chatbotViewModel);

            return(Response(chatbotViewModel));
        }
        public void Update(ChatbotViewModel chatbotViewModel)
        {
            var updateCommand = _mapper.Map <UpdateChatbotCommand>(chatbotViewModel);

            Bus.SendCommand(updateCommand);
        }