Esempio n. 1
0
        public void CreateAccount(DalAccount account)
        {
            if (account == null)
            {
                throw new ArgumentNullException(nameof(account));
            }

            var accountOwner = GetAccountOwner(account);

            _dbContext.Set <AccountHolder>().Add(accountOwner);

            //////////////////TODO
        }
Esempio n. 2
0
        //public void Create(DalAccount e)
        //{
        //    accounts.Add(e);
        //}

        public void Create(DalAccount e)
        {
            var account = new Account()
            {
                Id              = e.Id,
                AccountNumber   = e.AccountNumber,
                AccountHolderId = e.AccountHolder.Id,
                Type            = e.Type,
                Balance         = e.Balance,
                Bonus           = e.Bonus
            };

            context.Set <Account>().Add(account);
        }
Esempio n. 3
0
        /// <inheritdoc />
        public void RemoveAccount(DalAccount account)
        {
            if (ReferenceEquals(account, null))
            {
                throw new ArgumentNullException(nameof(account));
            }

            try
            {
                var ormBankUser = this.FindBankUserByEmail(account.BankUser.Email);
                var ormAccount  = FindAccoundById(ormBankUser, account.Id);
                _dbContext.Entry(ormAccount).State = EntityState.Deleted;
            }
            catch (Exception e)
            {
                throw new RepositoryException("Delete account error.", e);
            }
        }
Esempio n. 4
0
        /// <inheritdoc />
        public void AddAccount(DalAccount account)
        {
            if (ReferenceEquals(account, null))
            {
                throw new ArgumentNullException(nameof(account));
            }

            try
            {
                var ormBankUser = this.FindBankUserByEmail(account.BankUser.Email);
                var ormAccount  = account.ToOrmAccount(ormBankUser);
                _dbContext.Set <Account>().Add(ormAccount);
            }
            catch (Exception e)
            {
                throw new RepositoryException("Add account error.", e);
            }
        }
Esempio n. 5
0
        private static AccountType GetAccountType(DalAccount account)
        {
            if (account.Type.Contains("Gold"))
            {
                return(AccountType.Gold);
            }

            if (account.Type.Contains("Platinum"))
            {
                return(AccountType.Platinum);
            }

            if (account.Type.Contains("Silver"))
            {
                return(AccountType.Silver);
            }

            return(AccountType.Base);
        }
Esempio n. 6
0
 public void RemoveAccount(DalAccount account)
 {
     throw new NotImplementedException();
 }
Esempio n. 7
0
 public void Update(DalAccount entity)
 {
     throw new NotImplementedException();
 }
Esempio n. 8
0
 public void Delete(DalAccount e)
 {
     accounts.Remove(e);
 }