public void AddUser(string name, string pass, bool type) { usuari u = new usuari(name, pass, type); context.usuaris.Add(u); context.SaveChanges(); }
public void AddUser(string name, string pass, bool type) { try { usuari u = new usuari(name, pass, type); context.usuaris.Add(u); context.SaveChanges(); } catch (DbUpdateException) { MessageBox.Show("This user already exists!"); } }
public int ExistUser(string name, string pass) { usuari user = context.usuaris.Where(x => x.name.Equals(name) && x.password.Equals(pass)).SingleOrDefault(); if (user != null) { if (user.userType == true) { return(1); } else { return(0); } } return(-1); }