Files
Umbraco-CMS/src/Umbraco.Core/Models/Mapping/CodeFileMapDefinition.cs

75 lines
3.0 KiB
C#
Raw Normal View History

2019-03-24 12:01:23 +01:00
using Umbraco.Core.Mapping;
2017-05-12 14:49:44 +02:00
using Umbraco.Core.Models;
using Umbraco.Web.Models.ContentEditing;
namespace Umbraco.Web.Models.Mapping
{
2019-04-03 10:39:49 +02:00
public class CodeFileMapDefinition : IMapDefinition
2017-05-12 14:49:44 +02:00
{
2019-04-03 10:39:49 +02:00
public void DefineMaps(UmbracoMapper mapper)
2017-05-12 14:49:44 +02:00
{
mapper.Define<IStylesheet, EntityBasic>((source, context) => new EntityBasic(), Map);
mapper.Define<IPartialView, CodeFileDisplay>((source, context) => new CodeFileDisplay(), Map);
mapper.Define<IScript, CodeFileDisplay>((source, context) => new CodeFileDisplay(), Map);
mapper.Define<IStylesheet, CodeFileDisplay>((source, context) => new CodeFileDisplay(), Map);
2019-03-25 09:03:46 +01:00
mapper.Define<CodeFileDisplay, IPartialView>(Map);
mapper.Define<CodeFileDisplay, IScript>(Map);
2019-03-24 12:01:23 +01:00
}
// Umbraco.Code.MapAll -Trashed -Udi -Icon
private static void Map(IStylesheet source, EntityBasic target, MapperContext context)
2019-03-24 12:01:23 +01:00
{
target.Alias = source.Alias;
target.Id = source.Id;
target.Key = source.Key;
target.Name = source.Name;
target.ParentId = -1;
target.Path = source.Path;
}
// Umbraco.Code.MapAll -FileType -Notifications -Path -Snippet
private static void Map(IPartialView source, CodeFileDisplay target, MapperContext context)
2019-03-24 12:01:23 +01:00
{
target.Content = source.Content;
target.Id = source.Id.ToString();
target.Name = source.Name;
target.VirtualPath = source.VirtualPath;
}
2017-05-12 14:49:44 +02:00
2019-03-24 12:01:23 +01:00
// Umbraco.Code.MapAll -FileType -Notifications -Path -Snippet
private static void Map(IScript source, CodeFileDisplay target, MapperContext context)
2019-03-24 12:01:23 +01:00
{
target.Content = source.Content;
target.Id = source.Id.ToString();
target.Name = source.Name;
target.VirtualPath = source.VirtualPath;
}
2017-05-12 14:49:44 +02:00
2019-03-24 12:01:23 +01:00
// Umbraco.Code.MapAll -FileType -Notifications -Path -Snippet
private static void Map(IStylesheet source, CodeFileDisplay target, MapperContext context)
2019-03-24 12:01:23 +01:00
{
target.Content = source.Content;
target.Id = source.Id.ToString();
target.Name = source.Name;
target.VirtualPath = source.VirtualPath;
}
2018-10-27 21:18:03 +02:00
2019-03-24 12:01:23 +01:00
// Umbraco.Code.MapAll -CreateDate -DeleteDate -UpdateDate
// Umbraco.Code.MapAll -Id -Key -Alias -Name -OriginalPath -Path
private static void Map(CodeFileDisplay source, IPartialView target, MapperContext context)
2019-03-24 12:01:23 +01:00
{
target.Content = source.Content;
target.VirtualPath = source.VirtualPath;
}
2017-05-12 14:49:44 +02:00
2019-03-24 12:01:23 +01:00
// Umbraco.Code.MapAll -CreateDate -DeleteDate -UpdateDate -GetFileContent
// Umbraco.Code.MapAll -Id -Key -Alias -Name -OriginalPath -Path
private static void Map(CodeFileDisplay source, IScript target, MapperContext context)
2019-03-24 12:01:23 +01:00
{
target.Content = source.Content;
target.VirtualPath = source.VirtualPath;
2017-05-12 14:49:44 +02:00
}
}
}