Piscal Client improvements
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using AutoMapper;
|
||||
using LeafWeb.Core.Entities;
|
||||
using LeafWeb.Core.Utility;
|
||||
|
||||
namespace LeafWeb.Core.Remote
|
||||
{
|
||||
public class PiscalLeafInputFile
|
||||
{
|
||||
private static readonly IMapper Mapper;
|
||||
|
||||
public int Id { get; set; }
|
||||
public string Filename { get; set; }
|
||||
public byte[] Contents { get; set; }
|
||||
public string DirectoryName { get; set; }
|
||||
|
||||
static PiscalLeafInputFile()
|
||||
{
|
||||
var config =
|
||||
new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<LeafInputFile, PiscalLeafInputFile>()
|
||||
.ForMember(dest => dest.DirectoryName, opt => opt.MapFrom(
|
||||
src =>
|
||||
$"{src.Id}_{src.LeafInput.Name.FilterAlphaNumeric()}_{src.LeafInput.Identifier.FilterAlphaNumeric()}"
|
||||
));
|
||||
});
|
||||
Mapper = config.CreateMapper();
|
||||
}
|
||||
|
||||
public PiscalLeafInputFile() { }
|
||||
|
||||
public PiscalLeafInputFile(LeafInputFile leafInputFile)
|
||||
{
|
||||
Mapper.Map(leafInputFile, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user