private VehicleMakeModelDTOCollection makeCollectionToDTO(VehicleMakeCollection makeCollection) { VehicleMakeModelDTOCollection tempList = new VehicleMakeModelDTOCollection(); if (makeCollection !=null) { foreach(VehicleMake item in makeCollection) { if (string.IsNullOrEmpty(item.VehicleMakeName)) tempList.Add(new VehicleMakeModelDTO { VehicleMakeId = item.VehicleMakeId }); else tempList.Add(new VehicleMakeModelDTO { VehicleMakeId = item.VehicleMakeId, MakeName = item.VehicleMakeName }); } } return tempList; }
private VehicleMakeModelDTOCollection ModelCollectionToDTO(VehicleModelCollection modelCollection) { VehicleMakeModelDTOCollection tempList = new VehicleMakeModelDTOCollection(); VehicleMakeModelDTO tempItem; if(modelCollection != null) { foreach(VehicleModel item in modelCollection) { tempItem = new VehicleMakeModelDTO(); tempItem.VehicleModelId = item.VehicleModelId; if (!string.IsNullOrEmpty(item.VehicleModelName)) tempItem.ModelName = item.VehicleModelName; if(item.Make!= null) { tempItem.VehicleMakeId = item.Make.VehicleMakeId; if (!string.IsNullOrEmpty(item.Make.VehicleMakeName)) tempItem.MakeName = item.Make.VehicleMakeName; } tempList.Add(tempItem); } } return tempList; }