/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Id != null) { hashCode = hashCode * 59 + Id.GetHashCode(); } if (AuthorFirstName != null) { hashCode = hashCode * 59 + AuthorFirstName.GetHashCode(); } if (AuthorLastName != null) { hashCode = hashCode * 59 + AuthorLastName.GetHashCode(); } if (Title != null) { hashCode = hashCode * 59 + Title.GetHashCode(); } if (Description != null) { hashCode = hashCode * 59 + Description.GetHashCode(); } return(hashCode); } }
private bool authorFirstNameValidation() { if (AuthorFirstName.Equals(string.Empty)) { textBoxAuthorFirstName.BackColor = Color.Red; return(false); } else { textBoxAuthorFirstName.BackColor = Color.White; return(true); } }
/// <summary> /// Returns true if Book instances are equal /// </summary> /// <param name="other">Instance of Book to be compared</param> /// <returns>Boolean</returns> public bool Equals(Book other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( AuthorFirstName == other.AuthorFirstName || AuthorFirstName != null && AuthorFirstName.Equals(other.AuthorFirstName) ) && ( AuthorLastName == other.AuthorLastName || AuthorLastName != null && AuthorLastName.Equals(other.AuthorLastName) ) && ( Title == other.Title || Title != null && Title.Equals(other.Title) ) && ( Description == other.Description || Description != null && Description.Equals(other.Description) )); }