Beispiel #1
0
        public bool UpdateBankingAccount(BankingAccount bankingAccount)
        {
            DynamicParameters parameters = new DynamicParameters();

            parameters.Add("@ID", bankingAccount.ID);
            parameters.Add("@IDUser", bankingAccount.IDUser);
            parameters.Add("@Bankcode", bankingAccount.Bankcode);
            parameters.Add("@Bankname", bankingAccount.Bankname);
            parameters.Add("@Agency", bankingAccount.Agency);
            parameters.Add("@CurrentAccount", bankingAccount.CurrentAccount);
            parameters.Add("@Digit", bankingAccount.Digit);
            parameters.Add("@RegDate", bankingAccount.RegDate);


            return(SqlMapper.Execute(connection, SQL_UPDATE, parameters) > 0);
        }
 public BankingAccount CreateAccount(ApplicationUser user, float startingBalance = 0)
 {
     using (var context = GetContext())
     {
         var owner = context.Users.Find(user.Id);
         if (owner.Id != user.Id)
         {
             throw new Exception("User Not Found while Creating Account!");
         }
         var account = new BankingAccount
         {
             AccountOwner = owner,
             Balance      = startingBalance
         };
         context.BankingAccounts.Add(account);
         context.SaveChanges();
         return(account);
     }
 }
 public Transaction CreateTransaction(BankingAccount fromAccount, BankingAccount toAccount, float amount, string description, DateTime time)
 {
     using (var context = GetContext())
     {
         var from = context.BankingAccounts.Find(fromAccount.ID);
         var to   = context.BankingAccounts.Find(toAccount.ID);
         if (from.ID != fromAccount.ID || to.ID != toAccount.ID)
         {
             throw new Exception("User Not Found while Creating Transaction!");
         }
         var t = new Transaction
         {
             Amount      = amount,
             Description = description,
             From        = from,
             To          = to,
             Status      = "Pending",
             Time        = time
         };
         context.Transactions.Add(t);
         context.SaveChanges();
         return(t);
     }
 }
Beispiel #4
0
 public bool UpdateBankingAccount(BankingAccount bankingAccount)
 {
     return(BankingAccountDAL.UpdateBankingAccount(bankingAccount));
 }
Beispiel #5
0
 public int InsertBankingAccount(BankingAccount bankingAccount)
 {
     return(BankingAccountDAL.InsertBankingAccount(bankingAccount));
 }
Beispiel #6
0
 public void SetUp()
 {
     acc = new BankingAccount(defaultAccountName, defaultSnapshotFrequency);
 }
 public DepositTransaction(BankingAccount account, decimal amount)
 {
     _account = account;
     _amount  = amount;
 }
 public WithdrawTransaction(BankingAccount account, decimal amount)
 {
     _account = account;
     _amount  = amount;
 }