예제 #1
0
        public static domainModels.Theme ToDomainModel(this webModels.Theme item)
        {
            var retVal = new domainModels.Theme();

            retVal.Name      = item.Name;
            retVal.ThemePath = item.Path;

            return(retVal);
        }
예제 #2
0
		public static domainModels.Theme ToDomainModel(this webModels.Theme item)
		{
			var retVal = new domainModels.Theme();

			retVal.Name = item.Name;
			retVal.ThemePath = item.Path;

			return retVal;
		}
예제 #3
0
        public static webModels.Theme ToWebModel(this domainModels.Theme item)
        {
            var retVal = new webModels.Theme();

            retVal.Name     = item.Name;
            retVal.Path     = item.ThemePath;
            retVal.Modified = item.ModifiedDate ?? item.CreatedDate;

            return(retVal);
        }
		public void SaveContentItem(string path, ContentItem item)
		{
			var existingItem = ContentItems.FirstOrDefault(p => p.Path == path);
			if (existingItem != null)
			{
				existingItem.ByteContent = item.ByteContent;
				Update(existingItem);
			}
			else
			{
				item.Path = path;
				Add(item);
			}

			var steps = path.Split('/');
			if (steps.Length > 2)
			{
				var themePath = string.Join("/", steps[0], steps[1]);
				var theme = Themes.FirstOrDefault(t => t.Id == themePath);
				if (theme != null)
				{
					theme.ModifiedDate = DateTime.UtcNow;
					Update(theme);
				}
				else
				{
					theme = new Theme();
					theme.Id = themePath;
					theme.ThemePath = themePath;
					theme.Name = steps[1];
					theme.CreatedDate = DateTime.UtcNow;
					Add(theme);
				}
			}

			UnitOfWork.Commit();
		}
		public static Theme AsTheme(this ContentItem item)
		{
			var retVal = new Theme { Name = item.Path.Replace("/", string.Empty), ThemePath = item.Path };
			return retVal;
		}