public static int GetByPassword(string password, string name) { using (HomeCommitteeDBEntities db = new HomeCommitteeDBEntities()) { user_tbl user = db.user_tbl.FirstOrDefault(u => u.password == password && u.user_name == name); return(user != null ? user.id : -1); //if(db.user_tbl.Where(u => String.Equals(u.password, password))!=null) // return true; // if (db.user_tbl.FirstOrDefault(u => String.Equals(u.password, password)) != null) //return false; // return db.user_tbl.FirstOrDefault(u => String.Equals(u.password, password)); } }
public static void Add(user_tbl user) { try { using (HomeCommitteeDBEntities db = new HomeCommitteeDBEntities()) { db.user_tbl.Add(user); db.SaveChanges(); } } catch { throw; } }