Beispiel #1
0
        private static void SaveList(Repository repository, Dictionary <string, MediaFolder> folders)
        {
            if (folders != null && folders.Count > 0)
            {
                var xml = DataContractSerializationHelper.SerializeAsXml(folders);

                var container = MediaBlobHelper.InitializeRepositoryContainer(repository);

                var blobClient = CloudStorageAccountHelper.GetStorageAccount().CreateCloudBlobClient();

                var folderBlob = container.GetBlobReference(MediaBlobHelper.MediaDirectoryName);

                folderBlob.SetMediaFolderContentType();

                BlobRequestOptions header = new BlobRequestOptions();

                folderBlob.UploadText(xml);
            }
            else
            {
                var container = MediaBlobHelper.InitializeRepositoryContainer(repository);

                var blobClient = CloudStorageAccountHelper.GetStorageAccount().CreateCloudBlobClient();

                var folderBlob = container.GetBlobReference(MediaBlobHelper.MediaDirectoryName);

                folderBlob.DeleteIfExists();
            }
        }
Beispiel #2
0
        public static T ToPageEntity <T>(this Page model, T entity)
            where T : IPageEntity
        {
            if (string.IsNullOrEmpty(entity.SiteName))
            {
                entity.SiteName = model.Site.FullName;
            }
            if (string.IsNullOrEmpty(entity.FullName))
            {
                entity.FullName = model.FullName;
            }

            entity.IsDefault = model.IsDefault;

            if (model.Parent != null)
            {
                entity.ParentPage = model.Parent.FullName;
            }
            else
            {
                entity.ParentPage = "";
            }
            entity.ObjectXml = DataContractSerializationHelper.SerializeAsXml(model, KnownTypes);
            return(entity);
        }
Beispiel #3
0
 public static T ToUrlRedirectEntity <T>(this UrlRedirect model, T entity)
     where T : IUrlRedirectEntity
 {
     entity.SiteName  = model.Site.FullName;
     entity.UUID      = model.UUID;
     entity.ObjectXml = DataContractSerializationHelper.SerializeAsXml(model, KnownTypes);
     return(entity);
 }
Beispiel #4
0
 public static T ToSiteSettingEntity <T>(this Site model, T entity)
     where T : ISiteSettingEntity
 {
     entity.FullName = model.FullName;
     if (null != model.Parent)
     {
         entity.ParentName = model.Parent.FullName;
     }
     entity.ObjectXml = DataContractSerializationHelper.SerializeAsXml(model, KnownTypes);
     return(entity);
 }
Beispiel #5
0
        public static T ToABPageSettingEntity <T>(this ABPageSetting model, T entity)
            where T : IABPageSettingEntity
        {
            entity.UUID = model.UUID;
            if (null != model.Site)
            {
                entity.SiteName = model.Site.FullName;
            }

            entity.ObjectXml = DataContractSerializationHelper.SerializeAsXml(model, KnownTypes);
            return(entity);
        }
Beispiel #6
0
        public static T ToABSiteSettingEntity <T>(this ABSiteSetting model, T entity)
            where T : IABSiteSettingEntity
        {
            entity.UUID = model.UUID;
            if (!String.IsNullOrEmpty(model.MainSite))
            {
                entity.SiteName = model.MainSite;
            }

            entity.ObjectXml = DataContractSerializationHelper.SerializeAsXml(model, KnownTypes);
            return(entity);
        }
Beispiel #7
0
        public static T ToCustomErrorEntity <T>(this CustomError model, T entity)
            where T : ICustomErrorEntity
        {
            entity.UUID = model.UUID;
            if (string.IsNullOrEmpty(entity.SiteName))
            {
                entity.SiteName = model.Site.FullName;
            }

            entity.ObjectXml = DataContractSerializationHelper.SerializeAsXml(model, KnownTypes);
            return(entity);
        }
Beispiel #8
0
        public static SiteUserEntity ToEntity(this Kooboo.CMS.Sites.Models.User user, SiteUserEntity entity = null)
        {
            if (entity == null)
            {
                entity = new SiteUserEntity();
            }
            entity.SiteName = user.Site.Name;
            entity.UserName = user.UserName;

            entity.ObjectXml = DataContractSerializationHelper.SerializeAsXml(user);

            return(entity);
        }
Beispiel #9
0
        public static PageEntity ToPageEntity(this Page model)
        {
            PageEntity entity = new PageEntity(model.Site.Name, model.FullName);

            entity.IsDefault = model.IsDefault;

            if (model.Parent != null)
            {
                entity.ParentPage = model.Parent.FullName;
            }
            else
            {
                entity.ParentPage = "";
            }
            entity.ObjectXml = DataContractSerializationHelper.SerializeAsXml(model, KnownTypes);

            return(entity);
        }