/// <summary> /// Patch /// </summary> /// <param name="source"></param> /// <param name="target"></param> public static void Patch(this dataModel.DynamicContentItemProperty source, dataModel.DynamicContentItemProperty target) { var patchInjectionPolicy = new PatchInjection<dataModel.DynamicContentItemProperty>(x => x.BooleanValue, x => x.DateTimeValue, x => x.DecimalValue, x => x.IntegerValue, x => x.ShortTextValue, x => x.LongTextValue, x => x.ValueType); target.InjectFrom(patchInjectionPolicy, source); }
/// <summary> /// Patch changes /// </summary> /// <param name="source"></param> /// <param name="target"></param> public static void Patch(this dataModel.DynamicContentFolder source, dataModel.DynamicContentFolder target) { if (target == null) throw new ArgumentNullException("target"); var patchInjection = new PatchInjection<dataModel.DynamicContentFolder>(x => x.Name, x => x.Description, x => x.ImageUrl); target.InjectFrom(patchInjection, source); }
/// <summary> /// Patch changes /// </summary> /// <param name="source"></param> /// <param name="target"></param> public static void Patch(this dataModel.DynamicContentItem source, dataModel.DynamicContentItem target) { if (target == null) throw new ArgumentNullException("target"); var patchInjection = new PatchInjection<dataModel.DynamicContentItem>(x => x.Name, x => x.Description, x=>x.FolderId, x=>x.ImageUrl, x=>x.ContentTypeId); if (!source.PropertyValues.IsNullCollection()) { var propertyComparer = AnonymousComparer.Create((dataModel.DynamicContentItemProperty x) => x.Name); source.PropertyValues.Patch(target.PropertyValues, propertyComparer, (sourceProperty, targetProperty) => sourceProperty.Patch(targetProperty)); } target.InjectFrom(patchInjection, source); }
/// <summary> /// Patch changes /// </summary> /// <param name="source"></param> /// <param name="target"></param> public static void Patch(this dataModel.Promotion source, dataModel.Promotion target) { if (target == null) throw new ArgumentNullException("target"); var patchInjection = new PatchInjection<dataModel.Promotion>(x => x.Name, x => x.Description, x=>x.Priority, x=>x.CouponCode, x=>x.StoreId, x => x.StartDate, x => x.EndDate, x => x.IsActive, x => x.TotalLimit, x => x.PerCustomerLimit, x => x.PredicateSerialized, x => x.PredicateVisualTreeSerialized, x => x.RewardsSerialized); target.InjectFrom(patchInjection, source); if (!source.Coupons.IsNullCollection()) { var couponComparer = AnonymousComparer.Create((dataModel.Coupon x) => x.Code); source.Coupons.Patch(target.Coupons, (sourceCoupon, targetCoupon) => { return; }); } }
/// <summary> /// Patch changes /// </summary> /// <param name="source"></param> /// <param name="target"></param> public static void Patch(this dataModel.DynamicContentPublishingGroup source, dataModel.DynamicContentPublishingGroup target) { if (target == null) throw new ArgumentNullException("target"); var patchInjection = new PatchInjection<dataModel.DynamicContentPublishingGroup>(x=> x.StoreId, x => x.Name, x => x.Description, x => x.IsActive, x => x.StartDate, x => x.EndDate, x=>x.PredicateVisualTreeSerialized, x=>x.ConditionExpression); target.InjectFrom(patchInjection, source); if (!source.ContentItems.IsNullCollection()) { var itemComparer = AnonymousComparer.Create((dataModel.PublishingGroupContentItem x) => x.DynamicContentItemId); source.ContentItems.Patch(target.ContentItems, itemComparer, (sourceProperty, targetProperty) => { }); } if (!source.ContentPlaces.IsNullCollection()) { var itemComparer = AnonymousComparer.Create((dataModel.PublishingGroupContentPlace x) => x.DynamicContentPlaceId); source.ContentPlaces.Patch(target.ContentPlaces, itemComparer, (sourceProperty, targetProperty) => { }); } }