public static void UpdateBankAccount(BankAccounts bankAccount) { BankaIslemleriEntities entities = new BankaIslemleriEntities(); entities.BankAccounts.Where(k => k.Id == bankAccount.Id).FirstOrDefault().Amount = bankAccount.Amount; entities.SaveChanges(); }
public static void CreateUser(Users user) { BankaIslemleriEntities entities = new BankaIslemleriEntities(); entities.Users.Add(user); entities.SaveChanges(); }
public static void InsertBankAccountToUser(BankAccounts bankAccount, int userId) { if (bankAccount != null) { BankaIslemleriEntities entities = new BankaIslemleriEntities(); var user = GetUserById(userId); if (user != null) { entities.Users.Where(k => k.Id == userId).FirstOrDefault().BankAccounts.Add(bankAccount); entities.SaveChanges(); } } }
public static Users GetUserById(int userId) { if (userId > 0) { BankaIslemleriEntities entities = new BankaIslemleriEntities(); var user = entities.Users.Where(k => k.Id == userId).FirstOrDefault(); return(user); } else { return(null); } }
public static void UpdateUser(Users user) { BankaIslemleriEntities entities = new BankaIslemleriEntities(); entities.SaveChanges(); }
public static List <Users> GetAllUsers() { BankaIslemleriEntities entities = new BankaIslemleriEntities(); return(entities.Users.ToList()); }