Example #1
0
 private VehicleCharacteristics GetExactMatchFromDatabase(
     string vin, string language)
 {
     using (VTSDatabase db = new VTSDatabase())
     {
         IList <VehicleCharacteristicsEntity> exactMatch =
             db.VehicleCharacteristics.Where(vc =>
                                             vc.Vin == vin && vc.Language == language).ToList();
         if (exactMatch.Count == 0)
         {
             return(null);
         }
         return(VehicleCharacteristicsAssembler.
                FromEntityToDomainObject(exactMatch.First()));
     }
 }
Example #2
0
 private VehicleCharacteristics GetBestMatchFromOurDatabase(
     string vin, string preferredLang)
 {
     using (VTSDatabase database = new VTSDatabase())
     {
         VehicleCharacteristicsEntity perfectMatch =
             database.VehicleCharacteristics.FirstOrDefault(
                 vc => vc.Vin == vin && vc.Language == preferredLang);
         if (perfectMatch != null)
         {
             return(VehicleCharacteristicsAssembler.
                    FromEntityToDomainObject(perfectMatch));
         }
         VehicleCharacteristicsEntity anything =
             database.VehicleCharacteristics.FirstOrDefault(
                 vc => vc.Vin == vin);
         if (anything == null)
         {
             return(null);
         }
         return(VehicleCharacteristicsAssembler.
                FromEntityToDomainObject(anything));
     }
 }