Exemple #1
0
        public override bool Equals(object obj)
        {
            if (!(obj is RSSettingsModel other))
            {
                return(false);
            }

            if (Id != other.Id)
            {
                return(false);
            }

            if (SalesArea != other.SalesArea)
            {
                return(false);
            }

            // Check sizes of lists
            if (DemographicsSettings.Count() != other.DemographicsSettings.Count() ||
                DefaultDeliverySettingsList.Count() != other.DefaultDeliverySettingsList.Count())
            {
                return(false);
            }

            // Check collection items
            if (!DemographicsSettings.All(other.DemographicsSettings.Contains) ||
                !DefaultDeliverySettingsList.All(other.DefaultDeliverySettingsList.Contains))
            {
                return(false);
            }

            return(true);
        }
Exemple #2
0
        public object Clone()
        {
            var newObject = (RSSettingsModel)MemberwiseClone();

            newObject.DefaultDeliverySettingsList = DefaultDeliverySettingsList.Select(x => (RSDeliverySettingsModel)x.Clone());
            newObject.DemographicsSettings        = DemographicsSettings.Select(x => (RSDemographicSettingsModel)x.Clone());
            return(newObject);
        }