Currently I have this code on VFP
<apex:commandButton value="Edit" action="{!Edit}"
rendered="{!(($Profile.Name =='System Administrator'||$Profile.Name =='Sales Manager'))}" />
But I want to move away from VFP to APEX code instead.
How can I translate what I have in VFP to APEX code?
I have tried something like this:
//get the user id:
string u = Userinfo.getUserId();
//profile
list<profile> profile = [select id,name from profile where id =:u limit 1];
system.debug('///'+profile); //get the empty