public List <GearboxVM> GetGearboxTypes() { using (var db = new Lead2OrderGenerateDbEntities()) { List <l2g_tbl_Gearbox> gearboxTypes = db.l2g_tbl_Gearbox.ToList(); if (gearboxTypes.Count > 0) { List <GearboxVM> gearboxVMs = new List <GearboxVM>(); foreach (var gearBoxType in gearboxTypes) { gearboxVMs.Add(MappingConfig.GearboxToBusinessEntity(gearBoxType)); } return(gearboxVMs); } return(new List <GearboxVM>()); } }