ApplicationService.AccountApplicationService.When C# (CSharp) Method

When() public method

public When ( ClientPassedAway @event ) : void
@event Domain.Client.Clients.Events.ClientPassedAway
return void
        public void When(ClientPassedAway @event)
        {
            try
            {
                AccountNumber accountNumber = accountNumberService.GetAccountNumberForClient(@event.ClientId);

                if (accountNumber.IsEmpty())
                {
                    return;
                }

                Account account = accountRepository.Get(accountNumber);
                account.Cancel();
                accountRepository.Save(account);
                unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
        }