public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (Rating < 2 && ReviewerName.ToLower().StartsWith("scott")) { yield return(new ValidationResult("Sorry, Scott, you can't do this")); } }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (Rating < 2 && ReviewerName.ToLower().StartsWith("Arnido")) { yield return(new ValidationResult("No Trolls Allowed")); } }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (Rating <= 2 && ReviewerName.ToLower().StartsWith("eric")) { yield return(new ValidationResult("Stop giving bad results, Eric!")); } }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (Rating < 2 && ReviewerName.ToLower().StartsWith("milinda")) { yield return(new ValidationResult($"Sorry {ReviewerName}, you can't do this! rtgweqtwe")); } }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (Rating < 2 && ReviewerName.ToLower().StartsWith("woahwoah")) { yield return(new ValidationResult("Whoops")); } }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (Rating < 2 && ReviewerName.ToUpper().StartsWith("Edvinas")) { yield return(new ValidationResult("Sorry, Edvinas, you cant do that.")); } }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (Rating < 2 && ReviewerName.ToLower().StartsWith("rob")) { yield return(new ValidationResult("Sorry Rob, you cannot do this.")); } }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (Rating < 2 && ReviewerName.ToLower().StartsWith("ash")) { yield return(new ValidationResult("Sorry this is not possible")); } }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { // for example, to keep away reviewed named Bill who always gives low reviews if (Rating < 2 && ReviewerName.ToLower().StartsWith("bill")) { yield return(new ValidationResult("Sorry Bill, you can't do that thing.")); } }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (Rating < 2 && ReviewerName.ToLower().StartsWith("keith")) { yield return(new ValidationResult("Scorry, Keith uou can't do this")); } //throw new NotImplementedException(); }
/// <summary> /// Returns true if ProductReview instances are equal /// </summary> /// <param name="other">Instance of ProductReview to be compared</param> /// <returns>Boolean</returns> public bool Equals(ProductReview other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( ProductReviewID == other.ProductReviewID || ProductReviewID != null && ProductReviewID.Equals(other.ProductReviewID) ) && ( ProductId == other.ProductId || ProductId != null && ProductId.Equals(other.ProductId) ) && ( ReviewerName == other.ReviewerName || ReviewerName != null && ReviewerName.Equals(other.ReviewerName) ) && ( ReviewDate == other.ReviewDate || ReviewDate != null && ReviewDate.Equals(other.ReviewDate) ) && ( EmailAddress == other.EmailAddress || EmailAddress != null && EmailAddress.Equals(other.EmailAddress) ) && ( Rating == other.Rating || Rating != null && Rating.Equals(other.Rating) ) && ( Comments == other.Comments || Comments != null && Comments.Equals(other.Comments) )); }
/// <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 (ProductReviewID != null) { hashCode = hashCode * 59 + ProductReviewID.GetHashCode(); } if (ProductId != null) { hashCode = hashCode * 59 + ProductId.GetHashCode(); } if (ReviewerName != null) { hashCode = hashCode * 59 + ReviewerName.GetHashCode(); } if (ReviewDate != null) { hashCode = hashCode * 59 + ReviewDate.GetHashCode(); } if (EmailAddress != null) { hashCode = hashCode * 59 + EmailAddress.GetHashCode(); } if (Rating != null) { hashCode = hashCode * 59 + Rating.GetHashCode(); } if (Comments != null) { hashCode = hashCode * 59 + Comments.GetHashCode(); } return(hashCode); } }