Files
LeafWeb/Core/Remote/PiscalLeafInputFile.cs
T
2016-04-06 13:00:26 -04:00

33 lines
739 B
C#

using AutoMapper;
using LeafWeb.Core.Entities;
using LeafWeb.Core.Utility;
namespace LeafWeb.Core.Remote
{
public class PiscalLeafInputFile
{
private static readonly IMapper Mapper;
public string Filename { get; set; }
public byte[] Contents { get; set; }
static PiscalLeafInputFile()
{
var config =
new MapperConfiguration(cfg =>
{
cfg.CreateMap<LeafInputFile, PiscalLeafInputFile>()
.ForMember(dest => dest.Filename, opt =>
opt.MapFrom(src => src.Filename.WhitespaceToUnderscore().FilterValidFilename()));
});
Mapper = config.CreateMapper();
}
public PiscalLeafInputFile() { }
public PiscalLeafInputFile(LeafInputFile leafInputFile)
{
Mapper.Map(leafInputFile, this);
}
}
}