public void CreateAccount(DalAccount account) { if (account == null) { throw new ArgumentNullException(nameof(account)); } var accountOwner = GetAccountOwner(account); _dbContext.Set <AccountHolder>().Add(accountOwner); //////////////////TODO }
//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); }
/// <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); } }
/// <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); } }
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); }
public void RemoveAccount(DalAccount account) { throw new NotImplementedException(); }
public void Update(DalAccount entity) { throw new NotImplementedException(); }
public void Delete(DalAccount e) { accounts.Remove(e); }