enable extra fields to be imported via CSV

This commit is contained in:
DESKTOP-T0O5CDB\DESK-555BD
2024-07-09 14:48:09 -06:00
parent ef4deaba8f
commit 1eb6e2cedf
3 changed files with 29 additions and 8 deletions

View File

@@ -27,6 +27,18 @@ namespace CarCareTracker.MapProfile
Map(m => m.Type).Name(["type"]);
Map(m => m.Priority).Name(["priority"]);
Map(m => m.Tags).Name(["tags"]);
Map(m => m.ExtraFields).Convert(row =>
{
var attributes = new Dictionary<string, string>();
foreach (var header in row.Row.HeaderRecord)
{
if (header.ToLower().StartsWith("extrafield_"))
{
attributes.Add(header.Substring(11), row.Row.GetField(header));
}
}
return attributes;
}); ;
}
}
}