Exemplo n.º 1
0
        public static webModels.Page ToWebModel(this coreModels.Page page)
        {
            var retVal = new webModels.Page();

            retVal.Name = page.PageName;
            if (ContentTypeUtility.IsImageContentType(page.ContentType))
            {
                if (page.ByteContent != null)
                {
                    retVal.ByteContent = page.ByteContent;
                }
            }
            else if (ContentTypeUtility.IsTextContentType(page.ContentType))
            {
                if (page.ByteContent != null)
                {
                    retVal.Content = Encoding.UTF8.GetString(page.ByteContent);
                }
            }
            else             // treat as a binary file for now
            {
                if (page.ByteContent != null)
                {
                    retVal.ByteContent = page.ByteContent;
                }
            }
            retVal.Language     = page.Language;
            retVal.ModifiedDate = page.Updated.RemoveMilliseconds();
            retVal.Id           = page.Id;
            retVal.ContentType  = page.ContentType;

            return(retVal);
        }
		public void DeletePage(string storeId, Page[] pages)
		{
			foreach (var page in pages)
			{
				var fullPath = GetFullName(storeId, page.PageName, page.Language);

				_repository.DeletePage(fullPath);
			}
		}
Exemplo n.º 3
0
		public static IEnumerable<Page> GetShortPageInfoFromString(string[] pageNameAndLanguages)
		{
			var retVal = new List<Page>();

			foreach (var pageNameAndLanguage in pageNameAndLanguages)
			{
				var addedItem = new Page();
				addedItem.PageName = pageNameAndLanguage.Split('^')[1];
				addedItem.Language = pageNameAndLanguage.Split('^')[0];
				retVal.Add(addedItem);
			}

			return retVal;
		}
Exemplo n.º 4
0
		public static coreModels.Page ToCoreModel(this webModels.Page page)
		{
			var retVal = new coreModels.Page();

			if (page.ByteContent != null)
				retVal.ByteContent = page.ByteContent;
			else if (!string.IsNullOrEmpty(page.Content))
				retVal.ByteContent = Encoding.UTF8.GetBytes(page.Content);

			retVal.PageName = page.Name;
			retVal.Language = page.Language;
			retVal.ContentType = page.ContentType;

			return retVal;
		}
Exemplo n.º 5
0
        public static coreModels.Page ToCoreModel(this webModels.Page page)
        {
            var retVal = new coreModels.Page();

            if (page.ByteContent != null)
            {
                retVal.ByteContent = page.ByteContent;
            }
            else if (!string.IsNullOrEmpty(page.Content))
            {
                retVal.ByteContent = Encoding.UTF8.GetBytes(page.Content);
            }

            retVal.PageName    = page.Name;
            retVal.Language    = page.Language;
            retVal.ContentType = page.ContentType;

            return(retVal);
        }
Exemplo n.º 6
0
        public static webModels.Page ToWebModel(this coreModels.Page page)
        {
            var retVal = new webModels.Page();

            retVal.Name = page.PageName;
            if (ContentTypeUtility.IsImageContentType(page.ContentType))
            {
                if (page.ByteContent != null)
                {
                    //retVal.Content = ContentTypeUtility.ConvertImageToBase64String(item.ByteContent, item.ContentType);
                    retVal.ByteContent = page.ByteContent;
                }
                //else
                //{
                //	retVal.Content = retVal.AssetUrl = item.AssetUrl;
                //}
            }
            else if (ContentTypeUtility.IsTextContentType(page.ContentType))
            {
                if (page.ByteContent != null)
                {
                    retVal.Content = Encoding.UTF8.GetString(page.ByteContent);
                }
            }
            else             // treat as a binary file for now
            {
                if (page.ByteContent != null)
                {
                    retVal.ByteContent = page.ByteContent;
                }
            }
            retVal.Language     = page.Language;
            retVal.ModifiedDate = page.Updated;
            retVal.Id           = page.Id;
            retVal.ContentType  = page.ContentType;

            return(retVal);
        }
 private string GetStoreIdForPage(coreModels.Page page)
 {
     return(page.FullPath.Split(new char[] { '/' })[0]);
 }