public async Task <BankAccountFundsTransfer> GetBankAccountFundsTransfer(int transferId)
        {
            BankAccountFundsTransfer transfer = await context.BankAccountFundsTransfer.FindAsync(transferId);

            if (transfer != null)
            {
                switch (transfer.sourceAccountType)
                {
                case BankAccountType.Checking:
                    transfer.sourceAccount = await context.CheckingAccount.FindAsync(transfer.sourceAccountId);

                    break;

                case BankAccountType.Savings:
                    transfer.sourceAccount = await context.SavingsAccount.FindAsync(transfer.sourceAccountId);

                    break;
                }
                switch (transfer.destinationAccountType)
                {
                case BankAccountType.Checking:
                    transfer.destinationAccount = await context.CheckingAccount.FindAsync(transfer.destinationAccountId);

                    break;

                case BankAccountType.Savings:
                    transfer.destinationAccount = await context.SavingsAccount.FindAsync(transfer.destinationAccountId);

                    break;
                }
            }

            return(transfer);
        }
 public async Task AddBankAccountFundsTransferAsync(BankAccountFundsTransfer fundsTransfer)
 {
     if (!context.BankAccountFundsTransfer.Any(t => t.id == fundsTransfer.id))
     {
         await Task.Run(() => context.BankAccountFundsTransfer.Add(fundsTransfer));
     }
     else
     {
         throw new Exception("A Funds Transfer record already exists with the same Primary Key value");
     }
 }
        public async Task UpdateBankAccountFundsTransferAsync(BankAccountFundsTransfer fundsTransfer)
        {
            if (context.BankAccountFundsTransfer.Any(c => c.id == fundsTransfer.id))
            {
                await Task.Run(() => context.BankAccountFundsTransfer.Attach(fundsTransfer));

                await Task.Run(() => context.Entry(fundsTransfer).State = Microsoft.EntityFrameworkCore.EntityState.Modified);
            }
            else
            {
                throw new Exception("Unable to locate existing Funds Transfer record with provided Primary Key value");
            }
        }
        //private bool TableExists<T>(SQLiteConnection connection)
        //{
        //    const string cmdText = "SELECT name FROM sqlite_master WHERE type='table' AND name=?";
        //    var cmd = connection.CreateCommand(cmdText, typeof(T).Name);
        //    return cmd.ExecuteScalar<string>() != null;
        //}

        public async Task AddBankAccountFundsTransferAsync(BankAccountFundsTransfer fundsTransfer)
        {
            var inserted = await connection.InsertAsync(fundsTransfer);
        }
 public async Task UpdateBankAccountFundsTransferAsync(BankAccountFundsTransfer fundsTransfer)
 {
     var updated = await connection.UpdateAsync(fundsTransfer);
 }
        public async Task <BankAccountFundsTransfer> GetBankAccountFundsTransfer(int transferId)
        {
            BankAccountFundsTransfer transfer = await connection.FindAsync <BankAccountFundsTransfer>(transferId);

            return(transfer);
        }