コード例 #1
0
        public async Task <CloseResult> Process(CloseCommand command)
        {
            Account account = await accountReadOnlyRepository.Get(command.AccountId);

            account.Close();

            await accountWriteOnlyRepository.Delete(account);

            CloseResult result = resultConverter.Map <CloseResult>(account);

            return(result);
        }
コード例 #2
0
ファイル: CloseService.cs プロジェクト: rodrigoafb/acerola
        public async Task <CloseResult> Handle(CloseCommand command)
        {
            Customer customer = await customerReadOnlyRepository.GetByAccount(command.AccountId);

            Account account = customer.FindAccount(command.AccountId);

            customer.RemoveAccount(command.AccountId);
            await customerWriteOnlyRepository.Update(customer);

            CloseResult response = resultConverter.Map <CloseResult>(account);

            return(response);
        }
コード例 #3
0
        public async Task <CloseResult> Process(CloseCommand command)
        {
            Account account = await accountReadOnlyRepository.Get(command.AccountId);

            if (account == null)
            {
                throw new AccountNotFoundException($"The account {command.AccountId} does not exists or is already closed.");
            }

            account.Close();

            await accountWriteOnlyRepository.Delete(account);

            CloseResult result = new CloseResult(account);

            return(result);
        }