Here's the basic API example (not MVC specific) but should get you in the right direction.
// Creates a new instance of the Tree provider
TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);
// Gets a page
TreeNode page = tree.SelectNodes()
.Path("/Articles")
.OnCurrentSite()
.Culture("en-us")
.TopN(1)
.FirstOrDefault();
if (page != null)
{
// Iterates over all attachments of the page
foreach (DocumentAttachment attachment in page.AllAttachments)
{
// Perform any action with the attachment object (DocumentAttachment)
}
}
// To get only unsorted attachments, use the TreeNode.Attachments collection
// To get only page field attachments, use the TreeNode.GroupedAttachments collection