Esempio n. 1
0
        /// <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 :)

                hashCode = hashCode * 59 + Id.GetHashCode();

                hashCode = hashCode * 59 + RequestsRequestId.GetHashCode();
                if (Title != null)
                {
                    hashCode = hashCode * 59 + Title.GetHashCode();
                }


                hashCode = hashCode * 59 + AmountOffered.GetHashCode();
                if (Currency != null)
                {
                    hashCode = hashCode * 59 + Currency.GetHashCode();
                }
                if (Comment != null)
                {
                    hashCode = hashCode * 59 + Comment.GetHashCode();
                }
                if (ExpireDateOfOffer != null)
                {
                    hashCode = hashCode * 59 + ExpireDateOfOffer.GetHashCode();
                }
                return(hashCode);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Returns true if OfferDTO instances are equal
        /// </summary>
        /// <param name="other">Instance of OfferDTO to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OfferDTO other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||

                     Id.Equals(other.Id)
                     ) &&
                 (
                     RequestsRequestId == other.RequestsRequestId ||

                     RequestsRequestId.Equals(other.RequestsRequestId)
                 ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     AmountOffered == other.AmountOffered ||

                     AmountOffered.Equals(other.AmountOffered)
                 ) &&
                 (
                     Currency == other.Currency ||
                     Currency != null &&
                     Currency.Equals(other.Currency)
                 ) &&
                 (
                     Comment == other.Comment ||
                     Comment != null &&
                     Comment.Equals(other.Comment)
                 ) &&
                 (
                     ExpireDateOfOffer == other.ExpireDateOfOffer ||
                     ExpireDateOfOffer != null &&
                     ExpireDateOfOffer.Equals(other.ExpireDateOfOffer)
                 ));
        }