Class ContentControllerBase
An abstract base controller used for media/content/members to try to reduce code replication.
Inheritance
Namespace: Umbraco.Cms.Web.BackOffice.Controllers
Assembly: Umbraco.Web.BackOffice.dll
Syntax
[JsonDateTimeFormat]
public abstract class ContentControllerBase : BackOfficeNotificationsController, IUmbracoFeature, IDiscoverable
Constructors
View SourceContentControllerBase(ICultureDictionary, ILoggerFactory, IShortStringHelper, IEventMessagesFactory, ILocalizedTextService, IJsonSerializer)
Initializes a new instance of the ContentControllerBase class.
Declaration
protected ContentControllerBase(ICultureDictionary cultureDictionary, ILoggerFactory loggerFactory, IShortStringHelper shortStringHelper, IEventMessagesFactory eventMessages, ILocalizedTextService localizedTextService, IJsonSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
ICultureDictionary | cultureDictionary | |
Microsoft.Extensions.Logging.ILoggerFactory | loggerFactory | |
IShortStringHelper | shortStringHelper | |
IEventMessagesFactory | eventMessages | |
ILocalizedTextService | localizedTextService | |
IJsonSerializer | serializer |
Properties
View SourceCultureDictionary
Gets the ICultureDictionary
Declaration
protected ICultureDictionary CultureDictionary { get; }
Property Value
Type | Description |
---|---|
ICultureDictionary |
EventMessages
Gets the IEventMessagesFactory
Declaration
protected IEventMessagesFactory EventMessages { get; }
Property Value
Type | Description |
---|---|
IEventMessagesFactory |
LocalizedTextService
Gets the ILocalizedTextService
Declaration
protected ILocalizedTextService LocalizedTextService { get; }
Property Value
Type | Description |
---|---|
ILocalizedTextService |
LoggerFactory
Gets the Microsoft.Extensions.Logging.ILoggerFactory
Declaration
protected ILoggerFactory LoggerFactory { get; }
Property Value
Type | Description |
---|---|
Microsoft.Extensions.Logging.ILoggerFactory |
ShortStringHelper
Gets the IShortStringHelper
Declaration
protected IShortStringHelper ShortStringHelper { get; }
Property Value
Type | Description |
---|---|
IShortStringHelper |
Methods
View SourceAddCancelMessage(INotificationModel, String)
Adds a cancelled message to the display
Declaration
protected void AddCancelMessage(INotificationModel display, string message)
Parameters
Type | Name | Description |
---|---|---|
INotificationModel | display | |
System.String | message |
AddCancelMessage(INotificationModel, String, String, String[])
Adds a cancelled message to the display
Declaration
protected void AddCancelMessage(INotificationModel display, string messageArea = "speechBubbles", string messageAlias = "operationCancelledText", string[] messageParams = null)
Parameters
Type | Name | Description |
---|---|---|
INotificationModel | display | |
System.String | messageArea | |
System.String | messageAlias | |
System.String[] | messageParams |
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
Declaration
protected TPersisted GetObjectFromRequest<TPersisted>(Func<TPersisted> getFromService)
Parameters
Type | Name | Description |
---|---|---|
Func<TPersisted> | getFromService |
Returns
Type | Description |
---|---|
TPersisted |
Type Parameters
Name | Description |
---|---|
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
Declaration
protected NotFoundObjectResult HandleContentNotFound(object id)
Parameters
Type | Name | Description |
---|---|---|
System.Object | id | The content ID to find |
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Mvc.NotFoundObjectResult | The error response |