Class ContentControllerBase
An abstract base controller used for media/content/members to try to reduce code replication.
Inheritance
System.Object
Microsoft.AspNetCore.Mvc.ControllerBase
Namespace: Umbraco.Cms.Web.BackOffice.Controllers
Assembly: Umbraco.Web.BackOffice.dll
Syntax
[JsonDateTimeFormat]
public abstract class ContentControllerBase : BackOfficeNotificationsController
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
Declaration
protected ICultureDictionary CultureDictionary { get; }
Property Value
| Type | Description |
|---|---|
| ICultureDictionary |
EventMessages
Gets the
Declaration
protected IEventMessagesFactory EventMessages { get; }
Property Value
| Type | Description |
|---|---|
| IEventMessagesFactory |
LocalizedTextService
Gets the
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
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(Nullable<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 |
|---|---|---|
| System.Nullable<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 |