Exemple #1
0
        public bool CreateNewAccountHolderAddAccountGuid(IPolarisAccountHolder accountHolder)
        {
            bool createSuccessful = false;

            try
            {
                PolarisEFContext efContext = new PolarisEFContext(connectionString);
                var polarisAccountHolder   = new PolarisAccountHolder
                {
                    //Create a new guid
                    AccountGuid   = Guid.NewGuid(),
                    AccountHolder = accountHolder.AccountHolder,
                    AccountType   = accountHolder.AccountType
                };

                efContext.Entry(polarisAccountHolder).State = EntityState.Added;
                efContext.PolarisAccounts.Add(polarisAccountHolder);
                efContext.SaveChanges();
                createSuccessful = true;

                return(createSuccessful);
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }
Exemple #2
0
        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;
            }
        }