Ejemplo n.º 1
0
        public async Task <IActionResult> Add([FromBody] ListModel model)
        {
            var user = await _userManagerWrapper.FindByNameAsync(User.Identity.Name);

            model.UserId = user.Id;
            var addlistCommand = new AddListCommand {
                Model = model
            };
            await _endpointInstance.Send("LifeManager.Lists", addlistCommand).ConfigureAwait(false);

            return(Ok());
        }
Ejemplo n.º 2
0
        private async Task <int> HandleAsync(AddListCommand command)
        {
            var list = new List {
                Name = command.Name
            };

            await this.context.Lists.AddAsync(list);

            await this.context.SaveChangesAsync();

            return(list.Id);
        }
Ejemplo n.º 3
0
        public async Task HandleAddCommand_ShouldCallListServiceCreate()
        {
            // Data
            var model = new ListModel {
                Id = Guid.NewGuid(), Name = "Todo list"
            };
            var addListCommand = new AddListCommand {
                Model = model
            };


            // Setup
            _mockListService.Setup(x => x.CreateList(model)).Returns(Task.CompletedTask).Verifiable();

            // Test
            var handler = new ListsEventHandler(_mockListService.Object);
            await handler.Handle(addListCommand, _mockMessageContext.Object);

            // Analysis
            _mockListService.Verify();
        }
Ejemplo n.º 4
0
        public MainPageViewModel()
        {
            _todoListRepository = new Repositories.TodoListRepository();

            if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
            {
                // designtime sample data
                var data = _todoListRepository.Sample().Select(x => new ViewModels.TodoListViewModel(x));
                TodoLists = new ObservableCollection <ViewModels.TodoListViewModel>(data);
            }
            else
            {
                // update Commands
                PropertyChanged += (s, e) =>
                {
                    AddListCommand.RaiseCanExecuteChanged();
                    RemoveListCommand.RaiseCanExecuteChanged();
                    RemoveAdsCommand.RaiseCanExecuteChanged();
                    ShowVideoAdCommand.RaiseCanExecuteChanged();
                };
            }
        }
Ejemplo n.º 5
0
        private static void Commanding(ActiveCampaignConnection connection, ActiveCampaignTestData testData)
        {
            var client = new ListCommandingClient(connection);

            var command = new AddListCommand("New list", "LEGALDESK", "Via Morgagni", "Verona", "IT");

            client.Add(command);

            ////var contactCommandingClient = new ContactCommandingClient(connection);

            ////         var addTagCommand = new AddTagsCommand("*****@*****.**", "tag1", "tag2", "tag3") ;

            ////contactCommandingClient.AddTags(addTagCommand);

            ////var removeTagsCommand = new RemoveTagsCommand("*****@*****.**", "tag2");

            ////contactCommandingClient.RemoveTags(removeTagsCommand);

            ////var contactQueryClient = new ContactQueryClient(connection);

            ////var contact = contactQueryClient.Get(testData.ContactEmail).Dump();

            ////contactCommandingClient.Delete(contact.Id).Dump();

            ////contactCommandingClient.Add(new AddContactCommand(testData.ContactId, testData.ContactEmail)).Dump();

            ////contact = contactQueryClient.Get(testData.ContactEmail).Dump();

            ////contactCommandingClient.Sync(new SyncContactCommand(testData.ContactEmail) { FirstName = "Bill", LastName = "White" });

            ////IAutomationCommandingClient automationCommandingClient = new AutomationCommandingClient(connection);

            ////automationCommandingClient.AddContact(testData.ContactEmail, testData.Automation).Dump();

            ////automationCommandingClient.RemoveContact(testData.ContactEmail, testData.Automation).Dump();
        }
Ejemplo n.º 6
0
 public ActiveCampaignResponse Add(AddListCommand command)
 {
     return(ExecutePostRequest <ActiveCampaignResponse>("list_add", command));
 }
Ejemplo n.º 7
0
 public async Task <int> CreateList([FromBody] AddListCommand command)
 {
     return(await commandProcessor.ProcessAsync(command));
 }
Ejemplo n.º 8
0
 public LookBookViewModel()
 {
     lookBookItems   = new ObservableCollection <LookBookModel>();
     addListCommand  = new AddListCommand();
     moreListCommand = new MoreListCommand();
 }