/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (Id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Id"); } if (DesktopImage != null) { DesktopImage.Validate(); } if (MobileImage != null) { MobileImage.Validate(); } if (Features != null) { foreach (var element in Features) { if (element != null) { element.Validate(); } } } }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (Id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Id"); } if (Name == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Name"); } if (Address == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Address"); } if (Contact == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Contact"); } if (Location == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Location"); } if (StaffedHours == null) { throw new ValidationException(ValidationRules.CannotBeNull, "StaffedHours"); } if (Features == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Features"); } if (PersonalTrainers == null) { throw new ValidationException(ValidationRules.CannotBeNull, "PersonalTrainers"); } if (GroupTraining == null) { throw new ValidationException(ValidationRules.CannotBeNull, "GroupTraining"); } if (DesktopImage != null) { DesktopImage.Validate(); } if (MobileImage != null) { MobileImage.Validate(); } if (Address != null) { Address.Validate(); } if (Location != null) { Location.Validate(); } if (StaffedHours != null) { foreach (var element in StaffedHours) { if (element != null) { element.Validate(); } } } if (Features != null) { foreach (var element1 in Features) { if (element1 != null) { element1.Validate(); } } } if (PersonalTrainers != null) { foreach (var element2 in PersonalTrainers) { if (element2 != null) { element2.Validate(); } } } if (SosChildrensVillage != null) { SosChildrensVillage.Validate(); } if (GroupTraining != null) { foreach (var element3 in GroupTraining) { if (element3 != null) { element3.Validate(); } } } }