Exemplo n.º 1
0
        public override async Task <ItemDataModel> CreateFromAsync(IDataFactory dataFactorySource,
                                                                   IDataFactory dataFactoryDestination,
                                                                   ItemDataModel itemDataModelSource,
                                                                   ItemDataModel itemDataModelDestinationParent, bool isTransfert, object data = null)
        {
            var itemDataModelDestination = await SiteBusinessModule.DuplicateAllAsync(_businessModuleFactory, dataFactorySource,
                                                                                      dataFactoryDestination, itemDataModelSource, itemDataModelDestinationParent, isTransfert);

            var addSiteInput = data as CreateFromSiteModel;

            if (addSiteInput != null)
            {
                var siteBusinessModel = (MasterBusinessModel)itemDataModelDestination.Data;
                siteBusinessModel.Elements.First(e => e.Property == "Title").Data = addSiteInput.Title;

                // On met à jour les id des images
                var imageIcones = GetImages(siteBusinessModel, "ImageIcone");
                if (imageIcones != null && imageIcones.Count > 0)
                {
                    UpdateImageId(imageIcones, itemDataModelDestination);
                    var element = siteBusinessModel.Elements.First(e => e.Property == "ImageIcone");
                    element.Data = JsonConvert.SerializeObject(imageIcones);
                }
                var imageLogos = GetImages(siteBusinessModel, "ImageLogo");
                if (imageLogos != null && imageLogos.Count > 0)
                {
                    UpdateImageId(imageLogos, itemDataModelDestination);
                    var element = siteBusinessModel.Elements.First(e => e.Property == "ImageLogo");
                    element.Data = JsonConvert.SerializeObject(imageLogos);
                }
            }

            return(itemDataModelDestination);
        }
Exemplo n.º 2
0
        public override async Task <ItemDataModel> CreateFromAsync(IDataFactory dataFactorySource,
                                                                   IDataFactory dataFactoryDestination,
                                                                   ItemDataModel itemDataModelSource,
                                                                   ItemDataModel itemDataModelDestinationParent, bool isTransfert, object data = null)
        {
            var itemDataModelDestination = await SiteBusinessModule.DuplicateAllAsync(_businessModuleFactory, dataFactorySource,
                                                                                      dataFactoryDestination, itemDataModelSource, itemDataModelDestinationParent, isTransfert);

            return(itemDataModelDestination);
        }
Exemplo n.º 3
0
 public override async Task <ItemDataModel> CreateFromAsync(IDataFactory dataFactorySource,
                                                            IDataFactory dataFactoryDestination,
                                                            ItemDataModel itemDataModelSource,
                                                            ItemDataModel itemDataModelDestinationParent, bool isTransfert, object data = null)
 {
     // TODO attention les id des images ne sont pas mis à jour
     return
         (await
          SiteBusinessModule.DuplicateAllAsync(_businessModuleFactory, dataFactorySource, dataFactoryDestination, itemDataModelSource,
                                               itemDataModelDestinationParent, isTransfert, data));
 }
 public async Task DeleteAsync(IDataFactory dataFactory, ICacheRepository cacheRepository, ItemDataModel itemDataModel)
 {
     await SiteBusinessModule.DeleteRecursiveAsync(_businessModuleFactory, dataFactory, cacheRepository, itemDataModel);
 }