Example #1
0
        public void DeleteAccount(int accountId)
        {
            InfrastructureAccount deleteAccount = GetAccount(accountId);

            if (deleteAccount != null)
            {
                Database.Remove(deleteAccount);
            }
        }
 public static DomainAccount ToDomain(this InfrastructureAccount @this)
 {
     return(new DomainAccount
     {
         AccountId = @this.AccountId,
         Balance = @this.Balance,
         ClientId = @this.ClientId
     });
 }
        public void RemoveAccount(int accountId)
        {
            InfrastructureAccount account = GetAccountById(accountId);

            if (account != null)
            {
                accounts.Remove(account);
            }
        }
        public void AddAccount()
        {
            InfrastructureAccount account = new InfrastructureAccount()
            {
                Balance  = 418,
                ClientId = 7
            };

            _context.Accounts.Add(account);
            _context.SaveChanges();
        }
        public bool UpdateAccount(int accountId)
        {
            InfrastructureAccount account = GetAccountById(accountId);

            if (account != null)
            {
                account.Balance += 400;
                return(true);
            }
            return(false);
        }
        public InfrastructureAccount CreateAcount(int accountId)
        {
            InfrastructureAccount account = new InfrastructureAccount
            {
                AccountId = accountId, Balance = new Random().Next(1000),
                ClientId  = accounts.Count + 1
            };

            accounts.Add(account);
            return(account);
        }
 public static DomainAccount ToDomain(this InfrastructureAccount @this)
 {
     if (@this == null)
     {
         throw new ArgumentNullException();
     }
     return(new DomainAccount()
     {
         ClientId = @this.ClientId,
         NumberOfAccount = @this.NumberOfAccount
     });
 }
Example #8
0
        public bool UpdateAccount(int accountId, InfrastructureAccount account)
        {
            InfrastructureAccount storedAccount = GetAccount(accountId);

            if (storedAccount != null)
            {
                storedAccount.NumberOfAccount = account.NumberOfAccount;
                storedAccount.ClientId        = account.ClientId;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #9
0
 public InfrastructureAccount CreateAccount(InfrastructureAccount account)
 {
     account.Id = Database.Count + 1;
     Database.Add(account);
     return(account);
 }