Table of Contents

Class ContentControllerBase

Namespace
Umbraco.Cms.Web.BackOffice.Controllers
Assembly
Umbraco.Web.BackOffice.dll

An abstract base controller used for media/content/members to try to reduce code replication.

public abstract class ContentControllerBase : BackOfficeNotificationsController
Inheritance
ContentControllerBase
Derived
Inherited Members

Constructors

ContentControllerBase(ICultureDictionary, ILoggerFactory, IShortStringHelper, IEventMessagesFactory, ILocalizedTextService, IJsonSerializer)

Initializes a new instance of the ContentControllerBase class.

protected ContentControllerBase(ICultureDictionary cultureDictionary, ILoggerFactory loggerFactory, IShortStringHelper shortStringHelper, IEventMessagesFactory eventMessages, ILocalizedTextService localizedTextService, IJsonSerializer serializer)

Parameters

cultureDictionary ICultureDictionary
loggerFactory ILoggerFactory
shortStringHelper IShortStringHelper
eventMessages IEventMessagesFactory
localizedTextService ILocalizedTextService
serializer IJsonSerializer

Properties

CultureDictionary

Gets the Umbraco.Cms.Core.Dictionary.ICultureDictionary

protected ICultureDictionary CultureDictionary { get; }

Property Value

ICultureDictionary

EventMessages

Gets the Umbraco.Cms.Core.Events.IEventMessagesFactory

protected IEventMessagesFactory EventMessages { get; }

Property Value

IEventMessagesFactory

LocalizedTextService

Gets the Umbraco.Cms.Core.Services.ILocalizedTextService

protected ILocalizedTextService LocalizedTextService { get; }

Property Value

ILocalizedTextService

LoggerFactory

Gets the ILoggerFactory

protected ILoggerFactory LoggerFactory { get; }

Property Value

ILoggerFactory

ShortStringHelper

Gets the Umbraco.Cms.Core.Strings.IShortStringHelper

protected IShortStringHelper ShortStringHelper { get; }

Property Value

IShortStringHelper

Methods

AddCancelMessage(INotificationModel, string)

Adds a cancelled message to the display

protected void AddCancelMessage(INotificationModel display, string message)

Parameters

display INotificationModel
message string

AddCancelMessage(INotificationModel?, string, string, string[]?)

Adds a cancelled message to the display

protected void AddCancelMessage(INotificationModel? display, string messageArea = "speechBubbles", string messageAlias = "operationCancelledText", string[]? messageParams = null)

Parameters

display INotificationModel
messageArea string
messageAlias string
messageParams string[]

GetObjectFromRequest<TPersisted>(Func<TPersisted>)

A helper method to attempt to get the instance from the request storage if it can be found there, otherwise gets it from the callback specified

protected TPersisted? GetObjectFromRequest<TPersisted>(Func<TPersisted> getFromService)

Parameters

getFromService Func<TPersisted>

Returns

TPersisted

Type Parameters

TPersisted

Remarks

This is useful for when filters have already looked up a persisted entity and we don't want to have to look it up again.

HandleContentNotFound(object)

Handles if the content for the specified ID isn't found

protected NotFoundObjectResult HandleContentNotFound(object id)

Parameters

id object

The content ID to find

Returns

NotFoundObjectResult

The error response