@@ -439,7 +439,8 @@ public IActionResult ImportToVehicleIdFromCsv(int vehicleId, ImportMode mode, st
439
439
Mileage = decimal . ToInt32 ( decimal . Parse ( importModel . Odometer , NumberStyles . Any ) ) ,
440
440
Gallons = decimal . Parse ( importModel . FuelConsumed , NumberStyles . Any ) ,
441
441
Notes = string . IsNullOrWhiteSpace ( importModel . Notes ) ? "" : importModel . Notes ,
442
- Tags = string . IsNullOrWhiteSpace ( importModel . Tags ) ? [ ] : importModel . Tags . Split ( " " ) . ToList ( )
442
+ Tags = string . IsNullOrWhiteSpace ( importModel . Tags ) ? [ ] : importModel . Tags . Split ( " " ) . ToList ( ) ,
443
+ ExtraFields = importModel . ExtraFields . Any ( ) ? importModel . ExtraFields . Select ( x => new ExtraField { Name = x . Key , Value = x . Value } ) . ToList ( ) : new List < ExtraField > ( )
443
444
} ;
444
445
if ( string . IsNullOrWhiteSpace ( importModel . Cost ) && ! string . IsNullOrWhiteSpace ( importModel . Price ) )
445
446
{
@@ -495,7 +496,8 @@ public IActionResult ImportToVehicleIdFromCsv(int vehicleId, ImportMode mode, st
495
496
Description = string . IsNullOrWhiteSpace ( importModel . Description ) ? $ "Service Record on { importModel . Date } " : importModel . Description ,
496
497
Notes = string . IsNullOrWhiteSpace ( importModel . Notes ) ? "" : importModel . Notes ,
497
498
Cost = decimal . Parse ( importModel . Cost , NumberStyles . Any ) ,
498
- Tags = string . IsNullOrWhiteSpace ( importModel . Tags ) ? [ ] : importModel . Tags . Split ( " " ) . ToList ( )
499
+ Tags = string . IsNullOrWhiteSpace ( importModel . Tags ) ? [ ] : importModel . Tags . Split ( " " ) . ToList ( ) ,
500
+ ExtraFields = importModel . ExtraFields . Any ( ) ? importModel . ExtraFields . Select ( x => new ExtraField { Name = x . Key , Value = x . Value } ) . ToList ( ) : new List < ExtraField > ( )
499
501
} ;
500
502
_serviceRecordDataAccess . SaveServiceRecordToVehicle ( convertedRecord ) ;
501
503
if ( _config . GetUserConfig ( User ) . EnableAutoOdometerInsert )
@@ -518,7 +520,8 @@ public IActionResult ImportToVehicleIdFromCsv(int vehicleId, ImportMode mode, st
518
520
InitialMileage = string . IsNullOrWhiteSpace ( importModel . InitialOdometer ) ? 0 : decimal . ToInt32 ( decimal . Parse ( importModel . InitialOdometer , NumberStyles . Any ) ) ,
519
521
Mileage = decimal . ToInt32 ( decimal . Parse ( importModel . Odometer , NumberStyles . Any ) ) ,
520
522
Notes = string . IsNullOrWhiteSpace ( importModel . Notes ) ? "" : importModel . Notes ,
521
- Tags = string . IsNullOrWhiteSpace ( importModel . Tags ) ? [ ] : importModel . Tags . Split ( " " ) . ToList ( )
523
+ Tags = string . IsNullOrWhiteSpace ( importModel . Tags ) ? [ ] : importModel . Tags . Split ( " " ) . ToList ( ) ,
524
+ ExtraFields = importModel . ExtraFields . Any ( ) ? importModel . ExtraFields . Select ( x => new ExtraField { Name = x . Key , Value = x . Value } ) . ToList ( ) : new List < ExtraField > ( )
522
525
} ;
523
526
_odometerRecordDataAccess . SaveOdometerRecordToVehicle ( convertedRecord ) ;
524
527
}
@@ -537,7 +540,8 @@ public IActionResult ImportToVehicleIdFromCsv(int vehicleId, ImportMode mode, st
537
540
Priority = parsedPriority ,
538
541
Description = string . IsNullOrWhiteSpace ( importModel . Description ) ? $ "Plan Record on { importModel . DateCreated } " : importModel . Description ,
539
542
Notes = string . IsNullOrWhiteSpace ( importModel . Notes ) ? "" : importModel . Notes ,
540
- Cost = decimal . Parse ( importModel . Cost , NumberStyles . Any )
543
+ Cost = decimal . Parse ( importModel . Cost , NumberStyles . Any ) ,
544
+ ExtraFields = importModel . ExtraFields . Any ( ) ? importModel . ExtraFields . Select ( x => new ExtraField { Name = x . Key , Value = x . Value } ) . ToList ( ) : new List < ExtraField > ( )
541
545
} ;
542
546
_planRecordDataAccess . SavePlanRecordToVehicle ( convertedRecord ) ;
543
547
}
@@ -551,7 +555,8 @@ public IActionResult ImportToVehicleIdFromCsv(int vehicleId, ImportMode mode, st
551
555
Description = string . IsNullOrWhiteSpace ( importModel . Description ) ? $ "Repair Record on { importModel . Date } " : importModel . Description ,
552
556
Notes = string . IsNullOrWhiteSpace ( importModel . Notes ) ? "" : importModel . Notes ,
553
557
Cost = decimal . Parse ( importModel . Cost , NumberStyles . Any ) ,
554
- Tags = string . IsNullOrWhiteSpace ( importModel . Tags ) ? [ ] : importModel . Tags . Split ( " " ) . ToList ( )
558
+ Tags = string . IsNullOrWhiteSpace ( importModel . Tags ) ? [ ] : importModel . Tags . Split ( " " ) . ToList ( ) ,
559
+ ExtraFields = importModel . ExtraFields . Any ( ) ? importModel . ExtraFields . Select ( x => new ExtraField { Name = x . Key , Value = x . Value } ) . ToList ( ) : new List < ExtraField > ( )
555
560
} ;
556
561
_collisionRecordDataAccess . SaveCollisionRecordToVehicle ( convertedRecord ) ;
557
562
if ( _config . GetUserConfig ( User ) . EnableAutoOdometerInsert )
@@ -575,7 +580,8 @@ public IActionResult ImportToVehicleIdFromCsv(int vehicleId, ImportMode mode, st
575
580
Description = string . IsNullOrWhiteSpace ( importModel . Description ) ? $ "Upgrade Record on { importModel . Date } " : importModel . Description ,
576
581
Notes = string . IsNullOrWhiteSpace ( importModel . Notes ) ? "" : importModel . Notes ,
577
582
Cost = decimal . Parse ( importModel . Cost , NumberStyles . Any ) ,
578
- Tags = string . IsNullOrWhiteSpace ( importModel . Tags ) ? [ ] : importModel . Tags . Split ( " " ) . ToList ( )
583
+ Tags = string . IsNullOrWhiteSpace ( importModel . Tags ) ? [ ] : importModel . Tags . Split ( " " ) . ToList ( ) ,
584
+ ExtraFields = importModel . ExtraFields . Any ( ) ? importModel . ExtraFields . Select ( x => new ExtraField { Name = x . Key , Value = x . Value } ) . ToList ( ) : new List < ExtraField > ( )
579
585
} ;
580
586
_upgradeRecordDataAccess . SaveUpgradeRecordToVehicle ( convertedRecord ) ;
581
587
if ( _config . GetUserConfig ( User ) . EnableAutoOdometerInsert )
@@ -601,7 +607,8 @@ public IActionResult ImportToVehicleIdFromCsv(int vehicleId, ImportMode mode, st
601
607
Description = importModel . Description ,
602
608
Cost = decimal . Parse ( importModel . Cost , NumberStyles . Any ) ,
603
609
Notes = importModel . Notes ,
604
- Tags = string . IsNullOrWhiteSpace ( importModel . Tags ) ? [ ] : importModel . Tags . Split ( " " ) . ToList ( )
610
+ Tags = string . IsNullOrWhiteSpace ( importModel . Tags ) ? [ ] : importModel . Tags . Split ( " " ) . ToList ( ) ,
611
+ ExtraFields = importModel . ExtraFields . Any ( ) ? importModel . ExtraFields . Select ( x => new ExtraField { Name = x . Key , Value = x . Value } ) . ToList ( ) : new List < ExtraField > ( )
605
612
} ;
606
613
_supplyRecordDataAccess . SaveSupplyRecordToVehicle ( convertedRecord ) ;
607
614
}
@@ -614,7 +621,8 @@ public IActionResult ImportToVehicleIdFromCsv(int vehicleId, ImportMode mode, st
614
621
Description = string . IsNullOrWhiteSpace ( importModel . Description ) ? $ "Tax Record on { importModel . Date } " : importModel . Description ,
615
622
Notes = string . IsNullOrWhiteSpace ( importModel . Notes ) ? "" : importModel . Notes ,
616
623
Cost = decimal . Parse ( importModel . Cost , NumberStyles . Any ) ,
617
- Tags = string . IsNullOrWhiteSpace ( importModel . Tags ) ? [ ] : importModel . Tags . Split ( " " ) . ToList ( )
624
+ Tags = string . IsNullOrWhiteSpace ( importModel . Tags ) ? [ ] : importModel . Tags . Split ( " " ) . ToList ( ) ,
625
+ ExtraFields = importModel . ExtraFields . Any ( ) ? importModel . ExtraFields . Select ( x => new ExtraField { Name = x . Key , Value = x . Value } ) . ToList ( ) : new List < ExtraField > ( )
618
626
} ;
619
627
_taxRecordDataAccess . SaveTaxRecordToVehicle ( convertedRecord ) ;
620
628
}
0 commit comments