i am using "Named Credential" in my code as below:
HttpRequest req = new HttpRequest();
req.setEndpoint('callout:testSite');
req.setMethod('GET');
Http http = new Http();
HTTPResponse res = http.send(req);
System.debug(res.getBody());
and my code is working fine. but i want to manage "Named Credential" value from my custom visualforce page as i want to create a single setting page for my app. i am looking for APEX sample code to do this functionality.