コード例 #1
0
        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));
        }
コード例 #2
0
ファイル: AppsController.cs プロジェクト: moayyaed/apptext
        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));
        }
コード例 #3
0
ファイル: ContentController.cs プロジェクト: moayyaed/apptext
        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));
        }
コード例 #4
0
ファイル: ApiKeysController.cs プロジェクト: moayyaed/apptext
        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));
            }
        }
コード例 #5
0
        public async Task Executes_all_pipes_PipelineContext()
        {
            await _dispatcher.ExecuteCommand <DoWorkCommand>(new DoWorkCommand());

            PipeVerify.PipesCalled.ShouldContain(x => x == typeof(DoWorkCommandPipe));
        }
コード例 #6
0
        public async Task Should_call_handler()
        {
            await _dispatcher.ExecuteCommand(new DoMoreWork());

            DoMoreWorkHandler.WasCalled.ShouldBeTrue();
        }
コード例 #7
0
ファイル: HangfireDispatcher.cs プロジェクト: dcomartin/Luigi
 public async Task ExecuteCommand(ICommand command)
 {
     await _dispatcher.ExecuteCommand(command);
 }