+ Start a Discussion
dlCamelotdlCamelot 

Rearrange Account ID Return Statements

How do I my code so that I can pull 1 return statement or the other.  See below:
 
@AuraEnabled 
    public static List<String> getDnBMatches(String companyName){
    	List<String> dnbFinalMatchList = new List<String>();  
        List<String> dnbCompleteMatches = new List<String>(); 
        List<String> dnbPartialMatches = new List<String>();
    	List<String> nameFragments = new List<String>();
        Map<id,DatacloudDandBcompany> dnbData = new Map<id,DatacloudDandBcompany>();
   
        if (String.isBlank(companyName)){
            	return null;
        }else{
            	for (String fragment : companyName.split(' ')){
                     nameFragments.add('%' + fragment + '%');
                     }
                dnbData.putall([SELECT companyId FROM DatacloudDandBCompany WHERE Name LIKE :nameFragments]);
                for (DatacloudDandBCompany c: dnbData.values()){
                    if (companyName == c.name){
                        dnbCompleteMatches.add(c.companyid);
                    }
                    dnbPartialMatches.add(c.companyid); 
                }
        
         return dnbCompleteMatches;
         return dnbPartialMatches;
        }
    }
This part is the challenge:
return dnbCompleteMatches; return dnbPartialMatches;