public async Task <IActionResult> Create(string appId, [FromBody] ContentCollection contentCollection) { var command = new SaveContentCollectionCommand(appId, contentCollection); var result = await _dispatcher.ExecuteCommand(command); return(this.HandleCreateCommandResult(result, contentCollection.Id, contentCollection)); }
public async Task <IActionResult> Create([FromBody] CreateAppCommand command) { var result = await _dispatcher.ExecuteCommand(command); var id = (result.ResultData as App)?.Id; return(this.HandleCreateCommandResult(result, id, result.ResultData)); }
public async Task <IActionResult> Create(string appId, [FromBody] SaveContentItemCommand contentItemCommand) { contentItemCommand.AppId = appId; var result = await _dispatcher.ExecuteCommand(contentItemCommand); var id = (result.ResultData as ContentItem)?.Id; return(this.HandleCreateCommandResult(result, id, result.ResultData)); }
public async Task <IActionResult> CreateApiKey(string appId, [FromBody] CreateApiKeyCommand command) { command.AppId = appId; var result = await _dispatcher.ExecuteCommand(command); var resultData = result.ResultData as CreateApiKeyResultData; if (resultData != null) { var uri = $"{appId}/apikeys/{resultData.ApiKey.Id}"; var payload = new { ApiKey = resultData.ReadableKey }; return(this.HandleCreateCommandResult(result, uri, payload)); } else { return(this.HandleCreateCommandResult(result, null, null)); } }
public async Task Executes_all_pipes_PipelineContext() { await _dispatcher.ExecuteCommand <DoWorkCommand>(new DoWorkCommand()); PipeVerify.PipesCalled.ShouldContain(x => x == typeof(DoWorkCommandPipe)); }
public async Task Should_call_handler() { await _dispatcher.ExecuteCommand(new DoMoreWork()); DoMoreWorkHandler.WasCalled.ShouldBeTrue(); }
public async Task ExecuteCommand(ICommand command) { await _dispatcher.ExecuteCommand(command); }