Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
 /// <summary>
 /// The remove address and phone.
 /// </summary>
 /// <param name="locationAddressAndPhone">
 /// The location address and phone.
 /// </param>
 public virtual void RemoveAddressAndPhone(LocationAddressAndPhone locationAddressAndPhone)
 {
     _locationAddressesAndPhones.Delete(locationAddressAndPhone);
     NotifyItemRemoved(() => LocationAddressesAndPhones, locationAddressAndPhone);
 }
Exemplo n.º 3
0
        /// <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;
        }
Exemplo n.º 4
0
 /// <summary>
 /// The remove address and phone.
 /// </summary>
 /// <param name="locationAddressAndPhone">
 /// The location address and phone.
 /// </param>
 public virtual void RemoveAddressAndPhone(LocationAddressAndPhone locationAddressAndPhone)
 {
     _locationAddressesAndPhones.Delete(locationAddressAndPhone);
     NotifyItemRemoved(() => LocationAddressesAndPhones, locationAddressAndPhone);
 }