/// <summary> /// The revise location address. /// </summary> /// <param name="locationAddress"> /// The location address. /// </param> public virtual void ReviseLocationAddress(LocationAddress locationAddress) { Check.IsNotNull(locationAddress, () => LocationAddress); DomainRuleEngine.CreateRuleEngine <Location, LocationAddress> (Location, () => ReviseLocationAddress) .WithContext(locationAddress) .WithContext(this) .Execute(() => { LocationAddress = locationAddress; }); }
/// <summary> /// The add address and phone. /// </summary> /// <param name="locationAddress"> /// The location address. /// </param> /// <returns> /// A LocationAddressAndPhone. /// </returns> public virtual LocationAddressAndPhone AddAddressAndPhone(LocationAddress locationAddress) { Check.IsNotNull(locationAddress, "locationAddress is required."); LocationAddressAndPhone locationAddressAndPhone = null; var createdLocationAddressAndPhone = new LocationAddressAndPhone(locationAddress); DomainRuleEngine.CreateRuleEngine(this, "AddAddressAndPhoneRuleSet") .WithContext(createdLocationAddressAndPhone) .Execute(() => { locationAddressAndPhone = createdLocationAddressAndPhone; locationAddressAndPhone.Location = this; _locationAddressesAndPhones.Add(locationAddressAndPhone); NotifyItemAdded(() => LocationAddressesAndPhones, locationAddressAndPhone); }); return(locationAddressAndPhone); }
/// <summary> /// Initializes a new instance of the <see cref="LocationAddressAndPhone"/> class. /// </summary> /// <param name="locationAddress"> /// The location address. /// </param> protected internal LocationAddressAndPhone(LocationAddress locationAddress) : this() { Check.IsNotNull(locationAddress, () => LocationAddress); }