I have an AddressBook controller that will return a list of "folders" (basically groups / locations). This may be called via an AJAX request or within a MVC page itself at render time.

How can I create a function that will work well for both scenarios? Here is my current Controller action which I seem to struggle with using within my MVC page

public ActionResult GetFolderList(int? parent)
{
    List<String> folderList = new List<String>();
    folderList.Add("East Midlands");
    folderList.Add("West Midlands");
    folderList.Add("South West");
    folderList.Add("North East");
    folderList.Add("North West");

    return Json(folderList);
}

Within page (not working atm)

@{
    var controller = new My.Controllers.AddressBookController();
    var what = controller.GetFolderList(0);

    foreach(var p in what){
        //i want to get the list items here
    }
}
Edit
Report