コード例 #1
0
ファイル: UsersController.cs プロジェクト: TomMalow/atc
        public Task <ActionResult> DeleteUserByIdAsync(DeleteUserByIdParameters parameters, [FromServices] IDeleteUserByIdHandler handler, CancellationToken cancellationToken)
        {
            if (handler is null)
            {
                throw new ArgumentNullException(nameof(handler));
            }

            return(InvokeDeleteUserByIdAsync(parameters, handler, cancellationToken));
        }
コード例 #2
0
        public Task <DeleteUserByIdResult> ExecuteAsync(DeleteUserByIdParameters parameters, CancellationToken cancellationToken = default)
        {
            if (parameters is null)
            {
                throw new System.ArgumentNullException(nameof(parameters));
            }

            return(InvokeExecuteAsync(parameters, cancellationToken));
        }
コード例 #3
0
ファイル: DeleteUserByIdHandler.cs プロジェクト: TomMalow/atc
        public Task <DeleteUserByIdResult> ExecuteAsync(DeleteUserByIdParameters parameters, CancellationToken cancellationToken = default)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            if (parameters.Id == Guid.Parse("77a33260-0007-441f-ba60-b0a833803fab"))
            {
                return(Task.FromResult(DeleteUserByIdResult.NotFound($"Can't find user with id={parameters.Id}")));
            }

            return(InvokeExecuteAsync(parameters, cancellationToken));
        }
コード例 #4
0
ファイル: UsersController.cs プロジェクト: TomMalow/atc
 private static async Task <ActionResult> InvokeDeleteUserByIdAsync(DeleteUserByIdParameters parameters, IDeleteUserByIdHandler handler, CancellationToken cancellationToken)
 {
     return(await handler.ExecuteAsync(parameters, cancellationToken));
 }
コード例 #5
0
 public Task <DeleteUserByIdResult> ExecuteAsync(DeleteUserByIdParameters parameters, CancellationToken cancellationToken = default)
 {
     return(Task.FromResult(DeleteUserByIdResult.Ok("Hallo world")));
 }
コード例 #6
0
ファイル: DeleteUserByIdHandler.cs プロジェクト: TomMalow/atc
 private async Task <DeleteUserByIdResult> InvokeExecuteAsync(DeleteUserByIdParameters parameters, CancellationToken cancellationToken)
 {
     return(await Task.FromResult("User deleted."));
 }
コード例 #7
0
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
        private async Task <DeleteUserByIdResult> InvokeExecuteAsync(DeleteUserByIdParameters parameters, CancellationToken cancellationToken)
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
        {
            throw new System.NotImplementedException();
        }