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;
|
2018-10-27 21:18:03 +02:00
|
|
|
|
using Stylesheet = Umbraco.Core.Models.Stylesheet;
|
2017-05-12 14:49:44 +02:00
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
{
|
2019-03-26 13:58:38 +01:00
|
|
|
|
mapper.Define<Stylesheet, EntityBasic>((source, context) => new EntityBasic(), Map);
|
|
|
|
|
|
mapper.Define<IPartialView, CodeFileDisplay>((source, context) => new CodeFileDisplay(), Map);
|
|
|
|
|
|
mapper.Define<Script, CodeFileDisplay>((source, context) => new CodeFileDisplay(), Map);
|
|
|
|
|
|
mapper.Define<Stylesheet, CodeFileDisplay>((source, context) => new CodeFileDisplay(), Map);
|
2019-03-25 09:03:46 +01:00
|
|
|
|
mapper.Define<CodeFileDisplay, IPartialView>(Map);
|
|
|
|
|
|
mapper.Define<CodeFileDisplay, Script>(Map);
|
2019-01-17 00:29:43 +11:00
|
|
|
|
|
2019-03-24 12:01:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Umbraco.Code.MapAll -Trashed -Udi -Icon
|
2019-03-26 13:58:38 +01:00
|
|
|
|
private static void Map(Stylesheet 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
|
2019-03-26 13:58:38 +01:00
|
|
|
|
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
|
2019-03-26 13:58:38 +01:00
|
|
|
|
private static void Map(Script 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
|
2019-03-26 13:58:38 +01:00
|
|
|
|
private static void Map(Stylesheet 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
|
2019-03-26 13:58:38 +01:00
|
|
|
|
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
|
2019-03-26 13:58:38 +01:00
|
|
|
|
private static void Map(CodeFileDisplay source, Script 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
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|