using AutoMapper; using LeafWeb.Core.Entities; namespace LeafWeb.WebCms.Models { public class LeafInputDataCurveViewModel { /// Sample CO2 concentration public double? CO2S { get; set; } /// PAR measured by the in-chamber quantum sensor public double? PARi { get; set; } /// temperature of leaf thermocouple public double? Tleaf { get; set; } /// DeltaF/Fm, the fraction of absorbed PSII photons that are used in photochemistry public double? PhiPS2 { get; set; } public LeafInputDataCurveViewModel() {} static LeafInputDataCurveViewModel() { Mapper.CreateMap() .ForMember(m => m.CO2S, conf => conf.MapFrom(d => LeafInputData.Range(d.Data, c => c.CO2S))) .ForMember(m => m.PARi, conf => conf.MapFrom(d => LeafInputData.Range(d.Data, c => c.PARi))) .ForMember(m => m.Tleaf, conf => conf.MapFrom(d => LeafInputData.Range(d.Data, c => c.Tleaf))) .ForMember(m => m.PhiPS2, conf => conf.MapFrom(d => LeafInputData.Range(d.Data, c => c.PhiPS2))) ; } public LeafInputDataCurveViewModel(LeafInputDataCurve leafInputDataCurve) { Mapper.Map(leafInputDataCurve, this); } public LeafInputDataCurveViewModel(LeafInputData leafInputData) { Mapper.Map(leafInputData, this); //CO2S = LeafInputData.Range(dataCurves, c => c.CO2S); //PARi = LeafInputData.Range(dataCurves, c => c.PARi); //Tleaf = LeafInputData.Range(dataCurves, c => c.Tleaf); //PhiPS2 = LeafInputData.Range(dataCurves, c => c.PhiPS2); } } }