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-03-24 12:01:23 +01:00
|
|
|
|
public class CodeFileMapperProfile : IMapperProfile
|
2017-05-12 14:49:44 +02:00
|
|
|
|
{
|
2019-03-24 12:01:23 +01:00
|
|
|
|
public void SetMaps(Mapper mapper)
|
2017-05-12 14:49:44 +02:00
|
|
|
|
{
|
2019-03-25 09:03:46 +01:00
|
|
|
|
mapper.Define<Stylesheet, EntityBasic>(source => new EntityBasic(), Map);
|
|
|
|
|
|
mapper.Define<IPartialView, CodeFileDisplay>(source => new CodeFileDisplay(), Map);
|
|
|
|
|
|
mapper.Define<Script, CodeFileDisplay>(source => new CodeFileDisplay(), Map);
|
|
|
|
|
|
mapper.Define<Stylesheet, CodeFileDisplay>(source => new CodeFileDisplay(), Map);
|
|
|
|
|
|
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
|
|
|
|
|
|
private static void Map(Stylesheet source, EntityBasic target)
|
|
|
|
|
|
{
|
|
|
|
|
|
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)
|
|
|
|
|
|
{
|
|
|
|
|
|
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(Script source, CodeFileDisplay target)
|
|
|
|
|
|
{
|
|
|
|
|
|
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(Stylesheet source, CodeFileDisplay target)
|
|
|
|
|
|
{
|
|
|
|
|
|
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)
|
|
|
|
|
|
{
|
|
|
|
|
|
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, Script target)
|
|
|
|
|
|
{
|
|
|
|
|
|
target.Content = source.Content;
|
|
|
|
|
|
target.VirtualPath = source.VirtualPath;
|
2017-05-12 14:49:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|