Class DictionaryController
- Namespace
- Umbraco.Cms.Web.BackOffice.Controllers
- Assembly
- Umbraco.Web.BackOffice.dll
The API controller used for editing dictionary items
[Authorize(Policy = "TreeAccessDictionary")]
public class DictionaryController : BackOfficeNotificationsController
- Inheritance
-
DictionaryController
- Inherited Members
Remarks
The security for this controller is defined to allow full CRUD access to dictionary if the user has access to either: Dictionary
Constructors
DictionaryController(ILogger<DictionaryController>, ILocalizationService, IBackOfficeSecurityAccessor, IOptionsSnapshot<GlobalSettings>, ILocalizedTextService, IUmbracoMapper)
[Obsolete("Please use ctor that also takes an IEntityXmlSerializer, IHostingEnvironment & PackageDataInstallation instead, scheduled for removal in v12")]
public DictionaryController(ILogger<DictionaryController> logger, ILocalizationService localizationService, IBackOfficeSecurityAccessor backofficeSecurityAccessor, IOptionsSnapshot<GlobalSettings> globalSettings, ILocalizedTextService localizedTextService, IUmbracoMapper umbracoMapper)
Parameters
loggerILogger<DictionaryController>localizationServiceILocalizationServicebackofficeSecurityAccessorIBackOfficeSecurityAccessorglobalSettingsIOptionsSnapshot<GlobalSettings>localizedTextServiceILocalizedTextServiceumbracoMapperIUmbracoMapper
DictionaryController(ILogger<DictionaryController>, ILocalizationService, IBackOfficeSecurityAccessor, IOptionsSnapshot<GlobalSettings>, ILocalizedTextService, IUmbracoMapper, IEntityXmlSerializer, IHostingEnvironment, PackageDataInstallation)
[ActivatorUtilitiesConstructor]
public DictionaryController(ILogger<DictionaryController> logger, ILocalizationService localizationService, IBackOfficeSecurityAccessor backofficeSecurityAccessor, IOptionsSnapshot<GlobalSettings> globalSettings, ILocalizedTextService localizedTextService, IUmbracoMapper umbracoMapper, IEntityXmlSerializer serializer, IHostingEnvironment hostingEnvironment, PackageDataInstallation packageDataInstallation)
Parameters
loggerILogger<DictionaryController>localizationServiceILocalizationServicebackofficeSecurityAccessorIBackOfficeSecurityAccessorglobalSettingsIOptionsSnapshot<GlobalSettings>localizedTextServiceILocalizedTextServiceumbracoMapperIUmbracoMapperserializerIEntityXmlSerializerhostingEnvironmentIHostingEnvironmentpackageDataInstallationPackageDataInstallation
Methods
Create(int, string)
Creates a new dictionary item
[HttpPost]
public ActionResult<int> Create(int parentId, string key)
Parameters
Returns
DeleteById(int)
Deletes a data type with a given ID
[HttpDelete]
[HttpPost]
public IActionResult DeleteById(int id)
Parameters
idint
Returns
ExportDictionary(int, bool)
public IActionResult ExportDictionary(int id, bool includeChildren = false)
Parameters
Returns
GetById(Guid)
Gets a dictionary item by guid
public ActionResult<DictionaryDisplay?> GetById(Guid id)
Parameters
idGuidThe id.
Returns
- ActionResult<DictionaryDisplay>
The Umbraco.Cms.Core.Models.ContentEditing.DictionaryDisplay. Returns a not found response when dictionary item does not exist
GetById(int)
Gets a dictionary item by id
public ActionResult<DictionaryDisplay?> GetById(int id)
Parameters
idintThe id.
Returns
- ActionResult<DictionaryDisplay>
The Umbraco.Cms.Core.Models.ContentEditing.DictionaryDisplay. Returns a not found response when dictionary item does not exist
GetById(Udi)
Gets a dictionary item by udi
public ActionResult<DictionaryDisplay?> GetById(Udi id)
Parameters
idUdiThe id.
Returns
- ActionResult<DictionaryDisplay>
The Umbraco.Cms.Core.Models.ContentEditing.DictionaryDisplay. Returns a not found response when dictionary item does not exist
GetList()
Retrieves a list with all dictionary items
public IEnumerable<DictionaryOverviewDisplay> GetList()
Returns
- IEnumerable<DictionaryOverviewDisplay>
The IEnumerable<T>.
ImportDictionary(string, int)
public IActionResult ImportDictionary(string file, int parentId)
Parameters
Returns
PostMove(MoveOrCopy)
Changes the structure for dictionary items
public IActionResult? PostMove(MoveOrCopy move)
Parameters
moveMoveOrCopy
Returns
PostSave(DictionarySave)
Saves a dictionary item
public ActionResult<DictionaryDisplay?> PostSave(DictionarySave dictionary)
Parameters
dictionaryDictionarySaveThe dictionary.
Returns
- ActionResult<DictionaryDisplay>
The Umbraco.Cms.Core.Models.ContentEditing.DictionaryDisplay.
Upload(IFormFile)
public ActionResult<DictionaryImportModel> Upload(IFormFile file)
Parameters
fileIFormFile
Returns
- ActionResult<DictionaryImportModel>