UmbracoHelper
Using the Umbraco Helper
How to reference UmbracoHelper
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Web.Common;
using Umbraco.Cms.Web.Common.Controllers;
namespace UmbracoHelperDocs.Controllers;
[Route("customcontent/[action]")]
public class CustomContentController : Controller
{
private readonly UmbracoHelper _umbracoHelper;
public CustomContentController(UmbracoHelper umbracoHelper)
=> _umbracoHelper = umbracoHelper;
public IActionResult GetHomeNodeName()
{
IPublishedContent rootNode = _umbracoHelper
.ContentAtRoot()
.FirstOrDefault();
if (rootNode is null)
{
return NotFound();
}
return Ok(rootNode.Name);
}
}IPublishedContent
Working with Content
.Content(Guid id)
.ContentAtRoot()
Working with Media
.Media(Guid id)
.MediaAtRoot()
Working with Tags
Working with Members
Searching
Fetching Dictionary Values
.GetDictionaryValue(string key)
.GetDictionaryValueOrDefault(string key, string altText)
Last updated
Was this helpful?