/// <summary> /// Returns true if CurrentUserViewModel instances are equal /// </summary> /// <param name="other">Instance of CurrentUserViewModel to be compared</param> /// <returns>Boolean</returns> public bool Equals(CurrentUserViewModel other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( GivenName == other.GivenName || GivenName != null && GivenName.Equals(other.GivenName) ) && ( Surname == other.Surname || Surname != null && Surname.Equals(other.Surname) ) && ( Email == other.Email || Email != null && Email.Equals(other.Email) ) && ( Active == other.Active || Active != null && Active.Equals(other.Active) ) && ( SmUserId == other.SmUserId || SmUserId != null && SmUserId.Equals(other.SmUserId) ) && ( SmAuthorizationDirectory == other.SmAuthorizationDirectory || SmAuthorizationDirectory != null && SmAuthorizationDirectory.Equals(other.SmAuthorizationDirectory) ) && ( UserRoles == other.UserRoles || UserRoles != null && UserRoles.SequenceEqual(other.UserRoles) ) && ( District == other.District || District != null && District.Equals(other.District) )); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { int hash = 41; // Suitable nullity checks hash = hash * 59 + Id.GetHashCode(); if (GivenName != null) { hash = hash * 59 + GivenName.GetHashCode(); } if (Surname != null) { hash = hash * 59 + Surname.GetHashCode(); } hash = hash * 59 + Active.GetHashCode(); if (Initials != null) { hash = hash * 59 + Initials.GetHashCode(); } if (Email != null) { hash = hash * 59 + Email.GetHashCode(); } if (SmUserId != null) { hash = hash * 59 + SmUserId.GetHashCode(); } if (Guid != null) { hash = hash * 59 + Guid.GetHashCode(); } if (SmAuthorizationDirectory != null) { hash = hash * 59 + SmAuthorizationDirectory.GetHashCode(); } if (UserRoles != null) { hash = hash * 59 + UserRoles.GetHashCode(); } return(hash); } }
/// <summary> /// Returns true if User instances are equal /// </summary> /// <param name="other">Instance of User to be compared</param> /// <returns>Boolean</returns> public bool Equals(User other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id.Equals(other.Id) ) && ( GivenName == other.GivenName || GivenName != null && GivenName.Equals(other.GivenName) ) && ( Surname == other.Surname || Surname != null && Surname.Equals(other.Surname) ) && ( Active == other.Active || Active.Equals(other.Active) ) && ( Initials == other.Initials || Initials != null && Initials.Equals(other.Initials) ) && ( Email == other.Email || Email != null && Email.Equals(other.Email) ) && ( SmUserId == other.SmUserId || SmUserId != null && SmUserId.Equals(other.SmUserId) ) && ( Guid == other.Guid || Guid != null && Guid.Equals(other.Guid) ) && ( SmAuthorizationDirectory == other.SmAuthorizationDirectory || SmAuthorizationDirectory != null && SmAuthorizationDirectory.Equals(other.SmAuthorizationDirectory) ) && ( UserRoles == other.UserRoles || UserRoles != null && UserRoles.SequenceEqual(other.UserRoles) )); }