Simplify result status view model

This commit is contained in:
2016-04-18 10:43:49 -04:00
parent c71002d6a1
commit 6623aa48ea
@@ -15,8 +15,8 @@ namespace LeafWeb.Web.ViewModels.ResultStatus
public string LeafInputPhotosynthesisType { get; set; } public string LeafInputPhotosynthesisType { get; set; }
public string CurrentStatus { get; set; } public string CurrentStatus { get; set; }
public string[] ErrorMessages { get; set; } public string[] ErrorMessages { get; set; }
public string[] LeafOutputFilenames { get; set; } //public string[] LeafOutputFilenames { get; set; }
public bool HasLeafChartOutputFile { get; set; } //public bool HasLeafChartOutputFile { get; set; }
static ResultStatusViewModel() static ResultStatusViewModel()
{ {
@@ -25,16 +25,16 @@ namespace LeafWeb.Web.ViewModels.ResultStatus
{ {
cfg.CreateMap<Core.Entities.LeafInput, ResultStatusViewModel>() cfg.CreateMap<Core.Entities.LeafInput, ResultStatusViewModel>()
.ForMember(dest => dest.LeafInputId, opt => opt.MapFrom(src => src.Id)) .ForMember(dest => dest.LeafInputId, opt => opt.MapFrom(src => src.Id))
.ForMember(dest => dest.LeafOutputFilenames, //.ForMember(dest => dest.LeafOutputFilenames,
opt => opt.ResolveUsing( // opt => opt.ResolveUsing(
src => // src =>
src.OutputFiles? // src.OutputFiles?
.Select(o => o.Filename) // .Select(o => o.Filename)
.ToArray() // .ToArray()
?? new string[] {})) // ?? new string[] {}))
.ForMember(dest => dest.HasLeafChartOutputFile, //.ForMember(dest => dest.HasLeafChartOutputFile,
opt => opt.ResolveUsing( // opt => opt.ResolveUsing(
file => file.OutputFiles?.Any(o => o.IsLeafChartFile))) // file => file.OutputFiles?.Any(o => o.IsLeafChartFile)))
.ForMember(dest => dest.LeafInputName, opt => opt.MapFrom(src => src.Name)) .ForMember(dest => dest.LeafInputName, opt => opt.MapFrom(src => src.Name))
.ForMember(dest => dest.LeafInputIdentifier, opt => opt.MapFrom(src => src.Identifier)) .ForMember(dest => dest.LeafInputIdentifier, opt => opt.MapFrom(src => src.Identifier))
.ForMember(dest => dest.LeafInputSiteId, opt => opt.MapFrom(src => src.SiteId)) .ForMember(dest => dest.LeafInputSiteId, opt => opt.MapFrom(src => src.SiteId))