private bool UserAlreadyExists(User newUser, Users users) { return users .Items .Any( user => user.UserName.Equals( newUser.UserName, StringComparison.OrdinalIgnoreCase ) ); }
public bool TryGet(out Users users) { lock (locker) { try { using (var session = this.database.OpenSession()) { users = session.Load<Users>("users") ?? new Users(); } } catch { users = new Users(); return false; } } return true; }