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()); }
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); }
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(); }
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(); }; } }
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(); }
public ActiveCampaignResponse Add(AddListCommand command) { return(ExecutePostRequest <ActiveCampaignResponse>("list_add", command)); }
public async Task <int> CreateList([FromBody] AddListCommand command) { return(await commandProcessor.ProcessAsync(command)); }
public LookBookViewModel() { lookBookItems = new ObservableCollection <LookBookModel>(); addListCommand = new AddListCommand(); moreListCommand = new MoreListCommand(); }