コード例 #1
0
        public void Execute(GetFooByNameUseCaseRequest useCaseRequest, IOutputPort <GetFooByNameUseCaseResponse> outputPort)
        {
            Foo foo;

            try
            {
                foo = _fooRepository.GetByName(useCaseRequest.Name);
            }
            catch (Exception exception)
            {
                _coreLogger.LogError(exception);

                outputPort.HandleError(new SimpleUseCaseError(2, "Unknown Error"));
                return;
            }

            if (foo == default(Foo))
            {
                outputPort.HandleError(new SimpleUseCaseError(1, $"{nameof(Foo)} with {nameof(useCaseRequest.Name)} {useCaseRequest.Name} not exists"));
                return;
            }

            var getFooByNameUseCaseResponse = new GetFooByNameUseCaseResponse(foo);

            outputPort.HandleSuccess(getFooByNameUseCaseResponse);
        }
コード例 #2
0
 public async Task ExecuteAsync(GetFooByNameUseCaseRequest useCaseRequest, IOutputPort <GetFooByNameUseCaseResponse> outputPort)
 {
     throw new NotImplementedException();
 }