/// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = IsBanned.GetHashCode();
         hashCode = (hashCode * 397) ^ (Phone != null ? Phone.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Message != null ? Message.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BanPhoneMask != null ? BanPhoneMask.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ErrorMessage != null ? ErrorMessage.GetHashCode() : 0);
         return(hashCode);
     }
 }
Beispiel #2
0
        public async Task <ClaimsIdentity> GenerateUserIdentityAsync(UserManager <ApplicationUser> manager)
        {
            // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
            var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);

            // Add custom user claims here
            userIdentity.AddClaim(new Claim("UserScore", UserScore.ToString()));
            userIdentity.AddClaim(new Claim("OverdueCount", UserScore.ToString()));
            userIdentity.AddClaim(new Claim("IsBanned", IsBanned.ToString()));
            userIdentity.AddClaim(new Claim("LastBannedDate", IsBanned.ToString()));

            return(userIdentity);
        }
        /// <summary>
        /// Возвращает хэш код объекта.
        /// </summary>
        /// <returns>Хэш код объекта.</returns>
        public override int GetHashCode()
        {
            int result = 0;

            try
            {
                result += ID.GetHashCode() + Login.GetHashCode() + PasswordHash.GetHashCode() + PublicName.GetHashCode() + UserRole.GetHashCode() + IsBanned.GetHashCode();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(result);
        }