public int TransferAmount(string cc, float am, string option) { try { using (Bank_AccountsEntities1 ba = new Bank_AccountsEntities1()) { var n = ba.Person_Accounts.Where(i => i.Card_Code == cc).SingleOrDefault(); switch (option) { case "Add": n.Total_Amount = n.Total_Amount + am; break; case "Trans": n.Total_Amount = n.Total_Amount - am; break; default: break; } ba.SaveChanges(); return 1; } } catch (Exception) { return 0; } }
public Person_Accounts GetData(string username, string password, string cc) { using (Bank_AccountsEntities1 ba = new Bank_AccountsEntities1()) { return ba.Person_Accounts.Where(i => i.Username == username).Where(i => i.Password == password).Where(i => i.Card_Code == cc).SingleOrDefault(); } }