public SimpleAccountDto GetSimpleLoanAccount(string code)
        {
            AccountRepository repository = new AccountRepository();
            BankAccount       account    = repository.ActiveContext.BankAccounts.OfType <Loan>().FirstOrDefault(a => a.Code == code);

            if (account == null)
            {
                return(null);
            }
            SimpleAccountDto simpleAccountDto = (SimpleAccountDto) new SimpleAccountDto().InjectFrom(account);

            simpleAccountDto.IndexAccountId = account.IndexAccount.Id;
            return(simpleAccountDto);
        }
        public SimpleAccountDto GetSimpleBankAccount(string code)
        {
            AccountRepository repository  = new AccountRepository();
            BankAccount       bankAccount = repository.ActiveContext.BankAccounts
                                            .Where(a => a != null && a.Code == code)
                                            .FirstOrDefault();

            if (bankAccount != null)
            {
                SimpleAccountDto simpleAccountDto = (SimpleAccountDto) new SimpleAccountDto().InjectFrom(bankAccount);
                simpleAccountDto.IndexAccountId = bankAccount.IndexAccount.Id;
                return(simpleAccountDto);
            }
            return(null);
        }