public async Task <ActionResult <List <IPolarisTransaction> > > GetTransactionsByAccountGuid(string accountGuid) { try { string connectionString = config.GetSection("ConnectionStrings:PolarisDatabase").Value; #region SQL Testing //string sqlCommandText = $"SELECT TransactionGuid,AccountGuid,TransactionType," + // $"BeginningBalance,TransactionDateTime,TransactionAmount," + // $"Memo,EndingBalance FROM PolarisTransactions WHERE AccountGuid='{accountGuid}'"; //string commandTextString = "SELECT AccountGuid, AccountHolder, AccountType FROM PolarisAccounts"; //polarisLibrary = new PolarisDataLibrary(connectionString, commandTextString); //List<IPolarisTransaction> transactions = await polarisLibrary.GetTransactionsByAccountGuid(sqlCommandText); #endregion #region EF Testing polarisEfDataLibrary = new PolarisEFDataLibrary(connectionString); List <IPolarisTransaction> transactions = await polarisEfDataLibrary.GetTransactionsByAccountGuidEF(accountGuid); #endregion return(transactions); } catch (Exception) { throw; } }
public void DeleteAccountHolderByAccountGuid(string accountGuid) { string connectionString = config.GetSection("ConnectionStrings:PolarisDatabase").Value; #region SQL Testing //string commandText = $"DELETE FROM PolarisAccounts WHERE AccountGuid='{accountGuid}'"; //polarisLibrary = new PolarisDataLibrary(connectionString, commandText); //bool successfulDelete = polarisLibrary.DeleteAccountHolderByAccountGuid(commandText); #endregion #region EF Testing polarisEfDataLibrary = new PolarisEFDataLibrary(connectionString); bool isDeleted = polarisEfDataLibrary.DeleteAccountHolderByAccountGuid(accountGuid); #endregion }
public void DeleteAllTransactionsByAccountGuid(string accountId) { try { string connectionString = config.GetSection("ConnectionStrings:PolarisDatabase").Value; #region EF Testing polarisEfDataLibrary = new PolarisEFDataLibrary(connectionString); bool isDeleted = polarisEfDataLibrary.DeleteAllTransactionByAccountGuid(accountId); #endregion } catch (Exception) { throw; } }
public IPolarisAccountHolder GetSingleAccountHolderByGuid(string accountGuid) { try { string connectionString = config.GetSection("ConnectionStrings:PolarisDatabase").Value; #region SQL Testing //string commandText = // $"SELECT AccountGuid, AccountHolder, AccountType FROM PolarisAccounts WHERE AccountGuid='{accountGuid}'"; //polarisLibrary = new PolarisDataLibrary(connectionString, commandText); #endregion #region EF Testing polarisEfDataLibrary = new PolarisEFDataLibrary(connectionString); IPolarisAccountHolder accountHolder = polarisEfDataLibrary.GetSingleAccountByGuid(accountGuid); #endregion return(accountHolder); } catch (Exception) { throw; } }
public void PostAccountHolderNoAccountGuidField([FromBody] PolarisAccountHolder polarisAccountHolder) { try { string connectionString = config.GetSection("ConnectionStrings:PolarisDatabase").Value; #region EF Testing polarisEfDataLibrary = new PolarisEFDataLibrary(connectionString); IPolarisAccountHolder accountHolder = new PolarisAccountHolder { AccountGuid = Guid.NewGuid(), AccountHolder = polarisAccountHolder.AccountHolder, AccountType = polarisAccountHolder.AccountType }; bool isCreated = polarisEfDataLibrary.CreateNewAccountHolderAddAccountGuid(accountHolder); #endregion } catch (Exception) { throw; } }
public void PostAccountHolder([FromBody] PolarisAccountHolder polarisAccountHolder) { try { string connectionString = config.GetSection("ConnectionStrings:PolarisDatabase").Value; #region SQL Testing //Guid accountHolderGuid = Guid.Parse(polarisAccountHolder.AccountGuid.ToString()); //string accountHolder = polarisAccountHolder.AccountHolder; //string accountType = polarisAccountHolder.AccountType; //string commandText = // $"INSERT INTO PolarisAccounts (AccountGuid,AccountHolder,AccountType) " + // $"VALUES('{accountHolderGuid}','{accountHolder}','{accountType}')"; //polarisLibrary = new PolarisDataLibrary(connectionString, commandText); //polarisLibrary.CreateAccountHolder(); #endregion #region EF Testing polarisEfDataLibrary = new PolarisEFDataLibrary(connectionString); IPolarisAccountHolder accountHolder = new PolarisAccountHolder { AccountGuid = Guid.NewGuid(), AccountHolder = polarisAccountHolder.AccountHolder, AccountType = polarisAccountHolder.AccountType }; bool isCreated = polarisEfDataLibrary.CreateNewAccountHolder(accountHolder); #endregion } catch (Exception) { throw; } }
public async Task <ActionResult <List <IPolarisAccountHolder> > > GetAllAccounts() { try { string connectionString = config.GetSection("ConnectionStrings:PolarisDatabase").Value; #region SQL Testing //string commandText = "SELECT AccountGuid, AccountHolder, AccountType FROM PolarisAccounts"; //polarisLibrary = new PolarisDataLibrary(connectionString, commandText); #endregion #region EF Testing polarisEfDataLibrary = new PolarisEFDataLibrary(connectionString); List <IPolarisAccountHolder> accountInfoList = await polarisEfDataLibrary.GetAllAccounts(); #endregion return(accountInfoList); } catch (Exception) { throw; } }