Automap viewmodels for details display

This commit is contained in:
2020-07-02 08:55:52 -04:00
parent 2b5de1c4cd
commit 3dedac5591
14 changed files with 300 additions and 206 deletions
+1 -34
View File
@@ -35,40 +35,7 @@ namespace LeafWeb.WebCms.Models
[Display(Name = "Range")]
[RegularExpression(@"^([0-9]|[1-8][0-9]|9[0-9]|1[0-7][0-9]|180)$", ErrorMessage = "± longitude degrees")]
public string lonr { get; set; }
static LeafDataQuery()
{
//Mapper.CreateMap<LeafInputCreate, LeafInput>()
// .ForMember(dest => dest.PhotosynthesisType, opt => opt.Ignore());
//Mapper.CreateMap<LeafInput, LeafInputCreate>()
// .ForMember(dest => dest.PhotosynthesisType, opt => opt.Ignore());
}
public LeafDataQuery()
{
//PhotosynthesisType = new SelectListViewModel();
}
public NameValueCollection GetNameValueCollection(string prefix="")
{
var nvs = new NameValueCollection();
prefix =
string.IsNullOrEmpty(prefix)
? ""
: prefix + ".";
foreach (var pi in typeof(LeafDataQuery).GetProperties())
{
var value = pi.GetValue(this, null);
if (value == null)
continue;
nvs.Add(prefix + pi.Name, value?.ToString());
}
return nvs;
}
public bool HasExtendedParameters =>
!(
string.IsNullOrEmpty(siteid)