Example #1
0
 private bool UserAlreadyExists(User newUser, Users users)
 {
     return users
         .Items
         .Any(
             user =>
             user.UserName.Equals(
                 newUser.UserName,
                 StringComparison.OrdinalIgnoreCase
             )
         );
 }
Example #2
0
        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;
        }