Files
LeafWeb/Core/Remote/PiscalLeafInput.cs
T
2016-11-07 12:56:17 -05:00

37 lines
1.1 KiB
C#

using System.Linq;
using AutoMapper;
using LeafWeb.Core.Entities;
using LeafWeb.Core.Utility;
namespace LeafWeb.Core.Remote
{
public class PiscalLeafInput
{
public int LeafInputId { get; set; }
public string PhotosyntheticType { get; set; }
public string PiscalDirectoryName { get; set; }
public bool SuppressStorageCopy { get; set; }
public PiscalLeafInputFile[] InputFiles { get; set; }
public string NotifyCompleteUrl { get; set; }
static PiscalLeafInput()
{
Mapper.CreateMap<LeafInput, PiscalLeafInput>()
.ForMember(dest => dest.PiscalDirectoryName,
opt => opt.MapFrom(src => PiscalUtility.GetPiscalDirectoryName(src)))
.ForMember(dest => dest.LeafInputId, opt => opt.MapFrom(src => src.Id))
.ForMember(dest => dest.InputFiles, opt => opt.MapFrom(src => src.InputFiles.Select(f => new PiscalLeafInputFile(f)).ToArray()))
.ForMember(
dest => dest.PhotosyntheticType,
opt => opt.MapFrom(src => src.PhotosynthesisType.Id.WhitespaceToUnderscore()));
}
public PiscalLeafInput() { }
public PiscalLeafInput(LeafInput leafInput)
{
Mapper.Map(leafInput, this);
}
}
}