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); } }
public void AddAccount(Account account) { using (DB_AccountContext context = new DB_AccountContext()) { context.accountList.Add(account); context.SaveChanges(); } }
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); } }
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(); } }
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(); } }