public ActionResult <coreModel.DynamicContentPublication> GetNewDynamicPublication()
        {
            var retVal = new coreModel.DynamicContentPublication
            {
                ContentItems      = new coreModel.DynamicContentItem[] { },
                ContentPlaces     = new coreModel.DynamicContentPlace[] { },
                DynamicExpression = _marketingExtensionManager.ContentCondition,
                IsActive          = true
            };

            return(Ok(retVal));
        }
 private void FillConditions(coreModel.DynamicContentPublication publication)
 {
     publication.DynamicExpression = _marketingExtensionManager.ContentCondition;
     if (!string.IsNullOrEmpty(publication.PredicateVisualTreeSerialized))
     {
         publication.DynamicExpression = JsonConvert.DeserializeObject <IConditionTree>(publication.PredicateVisualTreeSerialized, new ConditionJsonConverter());
         if (_marketingExtensionManager.ContentCondition != null)
         {
             //Copy available elements from etalon because they not persisted
             var sourceBlocks = _marketingExtensionManager.ContentCondition.Traverse(x => x.Children);
             var targetBlocks = publication.DynamicExpression.Traverse(x => x.Children).ToList();
             foreach (var sourceBlock in sourceBlocks)
             {
                 foreach (var targetBlock in targetBlocks.Where(x => x.Id == sourceBlock.Id))
                 {
                     targetBlock.AvailableChildren = sourceBlock.AvailableChildren;
                 }
             }
             //copy available elements from etalon
             publication.DynamicExpression.AvailableChildren = _marketingExtensionManager.ContentCondition.AvailableChildren;
         }
     }
 }
Esempio n. 3
0
        public async Task <ActionResult> UpdateDynamicContentPublication([FromBody] coreModel.DynamicContentPublication publication)
        {
            await _dynamicContentService.SavePublicationsAsync(new[] { publication });

            return(NoContent());
        }
Esempio n. 4
0
        public async Task <ActionResult <coreModel.DynamicContentPublication> > CreateDynamicContentPublication([FromBody] coreModel.DynamicContentPublication publication)
        {
            await _dynamicContentService.SavePublicationsAsync(new[] { publication });

            return(await GetDynamicContentPublicationById(publication.Id));
        }