View Source
  Class MacrosController
  
  The API controller used for editing dictionary items
 
  
  
    Inheritance
      System.Object
      Microsoft.AspNetCore.Mvc.ControllerBase
      
      
      
      
      
      
   
  
  Assembly: Umbraco.Web.BackOffice.dll
  Syntax
  
    [Authorize(Policy = "TreeAccessMacros")]
public class MacrosController : BackOfficeNotificationsController
   
  Constructors
  
  
    View Source
  
  MacrosController(ParameterEditorCollection, IMacroService, IShortStringHelper, IBackOfficeSecurityAccessor, ILogger<MacrosController>, IHostingEnvironment, IUmbracoMapper)
  
  
  Declaration
  
    public MacrosController(ParameterEditorCollection parameterEditorCollection, IMacroService macroService, IShortStringHelper shortStringHelper, IBackOfficeSecurityAccessor backofficeSecurityAccessor, ILogger<MacrosController> logger, IHostingEnvironment hostingEnvironment, IUmbracoMapper umbracoMapper)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | ParameterEditorCollection | 
        parameterEditorCollection | 
         | 
      
      
        | IMacroService | 
        macroService | 
         | 
      
      
        | IShortStringHelper | 
        shortStringHelper | 
         | 
      
      
        | IBackOfficeSecurityAccessor | 
        backofficeSecurityAccessor | 
         | 
      
      
        | Microsoft.Extensions.Logging.ILogger<MacrosController> | 
        logger | 
         | 
      
      
        | IHostingEnvironment | 
        hostingEnvironment | 
         | 
      
      
        | IUmbracoMapper | 
        umbracoMapper | 
         | 
      
    
  
  Methods
  
  
    View Source
  
  Create(String)
  
  
  Declaration
  
    [HttpPost]
public ActionResult<int> Create(string name)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        name | 
        The name. 
 | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult<System.Int32> | 
        The id of the created macro 
 | 
      
    
  
  
    View Source
  
  DeleteById(Int32)
  
  
  Declaration
  
    [HttpPost]
public IActionResult DeleteById(int id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.IActionResult | 
         | 
      
    
  
  
    View Source
  
  GetById(Guid)
  
  
  Declaration
  
    [HttpGet]
public ActionResult<MacroDisplay?> GetById(Guid id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | Guid | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult<System.Nullable<MacroDisplay>> | 
         | 
      
    
  
  
    View Source
  
  GetById(Int32)
  
  
  Declaration
  
    [HttpGet]
public ActionResult<MacroDisplay?> GetById(int id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult<System.Nullable<MacroDisplay>> | 
         | 
      
    
  
  
    View Source
  
  GetById(Udi)
  
  
  Declaration
  
    [HttpGet]
public ActionResult<MacroDisplay?> GetById(Udi id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | Udi | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult<System.Nullable<MacroDisplay>> | 
         | 
      
    
  
  
    View Source
  
  GetGroupedParameterEditors()
  Gets the available parameter editors grouped by their group.
 
  
  Declaration
  
    public IDictionary<string, IEnumerable<IDataEditor>> GetGroupedParameterEditors()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | IDictionary<System.String, IEnumerable<IDataEditor>> | 
        The . 
 | 
      
    
  
  
    View Source
  
  GetParameterEditorByAlias(String)
  Get parameter editor by alias.
 
  
  Declaration
  
    public IDataEditor? GetParameterEditorByAlias(string alias)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        alias | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Nullable<IDataEditor> | 
        The . 
 | 
      
    
  
  
    View Source
  
  GetParameterEditors()
  Gets the available parameter editors
 
  
  Declaration
  
    public ParameterEditorCollection GetParameterEditors()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | ParameterEditorCollection | 
        The . 
 | 
      
    
  
  
    View Source
  
  GetPartialViews()
  Gets a list of available macro partials
 
  
  Declaration
  
    public IEnumerable<string> GetPartialViews()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | IEnumerable<System.String> | 
        The . 
 | 
      
    
  
  
    View Source
  
  Save(MacroDisplay)
  
  
  Declaration
  
    [HttpPost]
public ActionResult<MacroDisplay> Save(MacroDisplay macroDisplay)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | MacroDisplay | 
        macroDisplay | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult<MacroDisplay> | 
         |