+ Start a Discussion
Maria Alexander 9Maria Alexander 9 

Custom object invalid inside my apex controller?

I'm working on this Trailhead challenge : Save and Load Records with a Server-Side Controller
As required, I've created an Apex class to write my server-side controller - CampingItemController.
My code seems perfectly alright. I've tried with other code too that seems to work for others too. 
The problem is that my console tells me that Camping_Item__c is an invalid type. I don't seem to understand where I went wrong. Would appreciate if someone couldhelp me with this. Have been stuck with this for a really long time.  User-added image

 
Pablo Gonzalez Alvarez 3Pablo Gonzalez Alvarez 3
Did you resolve this? Can you paste the code so it's more clear, the screenshot is too small.
Maria Alexander 9Maria Alexander 9
Sure! This is the code I've written for my CampingListController ( Apex class )

public with sharing class CampingListController{
    @AuraEnabled
    public static List<Camping_Item__c> getItems() {
        return [SELECT Id, Name, Price__c, Quantity__c, Packed__c      
                FROM Camping_Item__c];
    }
    @auraenabled
    public static Camping_Item__c saveItem (Camping_Item__c item){
        insert item;
        return item;
    }
}