示例#1
0
 public int GetBalance(Account account)
 {
     using (DB_AccountContext context = new DB_AccountContext())
     {
         Account acc = context.accountList.Single(a => a.NumberPhone == account.NumberPhone);
         return(acc.Balance);
     }
 }
示例#2
0
 public void AddAccount(Account account)
 {
     using (DB_AccountContext context = new DB_AccountContext())
     {
         context.accountList.Add(account);
         context.SaveChanges();
     }
 }
示例#3
0
 public bool ThisAccountExists(Account account)
 {
     using (DB_AccountContext context = new DB_AccountContext())
     {
         string  numberPhone = account.NumberPhone;
         Account acc         = context.accountList.Find(numberPhone);
         return(acc != null);
     }
 }
示例#4
0
 public void SubstractBalance(Account account, int amount)
 {
     using (DB_AccountContext context = new DB_AccountContext())
     {
         Account acc = context.accountList.Single(a => a.NumberPhone == account.NumberPhone);
         acc.takeAwayMoney(amount);
         context.SaveChanges();
     }
 }
示例#5
0
 public void AddBalance(Account account, int balance)
 {
     using (DB_AccountContext context = new DB_AccountContext())
     {
         Account acc = context.accountList.Single(a => a.NumberPhone == account.NumberPhone);
         acc.addMoney(balance);
         context.SaveChanges();
     }
 }