Search Results for

    Show / Hide Table of Contents

    Class TemplatesController

    Controller for template management API endpoints including email, process, and event templates.

    Inheritance
    object
    ControllerBase
    TemplatesController
    Inherited Members
    ControllerBase.StatusCode(int)
    ControllerBase.StatusCode(int, object)
    ControllerBase.Content(string)
    ControllerBase.Content(string, string)
    ControllerBase.Content(string, string, Encoding)
    ControllerBase.Content(string, MediaTypeHeaderValue)
    ControllerBase.NoContent()
    ControllerBase.Ok()
    ControllerBase.Ok(object)
    ControllerBase.Redirect(string)
    ControllerBase.RedirectPermanent(string)
    ControllerBase.RedirectPreserveMethod(string)
    ControllerBase.RedirectPermanentPreserveMethod(string)
    ControllerBase.LocalRedirect(string)
    ControllerBase.LocalRedirectPermanent(string)
    ControllerBase.LocalRedirectPreserveMethod(string)
    ControllerBase.LocalRedirectPermanentPreserveMethod(string)
    ControllerBase.RedirectToAction()
    ControllerBase.RedirectToAction(string)
    ControllerBase.RedirectToAction(string, object)
    ControllerBase.RedirectToAction(string, string)
    ControllerBase.RedirectToAction(string, string, object)
    ControllerBase.RedirectToAction(string, string, string)
    ControllerBase.RedirectToAction(string, string, object, string)
    ControllerBase.RedirectToActionPreserveMethod(string, string, object, string)
    ControllerBase.RedirectToActionPermanent(string)
    ControllerBase.RedirectToActionPermanent(string, object)
    ControllerBase.RedirectToActionPermanent(string, string)
    ControllerBase.RedirectToActionPermanent(string, string, string)
    ControllerBase.RedirectToActionPermanent(string, string, object)
    ControllerBase.RedirectToActionPermanent(string, string, object, string)
    ControllerBase.RedirectToActionPermanentPreserveMethod(string, string, object, string)
    ControllerBase.RedirectToRoute(string)
    ControllerBase.RedirectToRoute(object)
    ControllerBase.RedirectToRoute(string, object)
    ControllerBase.RedirectToRoute(string, string)
    ControllerBase.RedirectToRoute(string, object, string)
    ControllerBase.RedirectToRoutePreserveMethod(string, object, string)
    ControllerBase.RedirectToRoutePermanent(string)
    ControllerBase.RedirectToRoutePermanent(object)
    ControllerBase.RedirectToRoutePermanent(string, object)
    ControllerBase.RedirectToRoutePermanent(string, string)
    ControllerBase.RedirectToRoutePermanent(string, object, string)
    ControllerBase.RedirectToRoutePermanentPreserveMethod(string, object, string)
    ControllerBase.RedirectToPage(string)
    ControllerBase.RedirectToPage(string, object)
    ControllerBase.RedirectToPage(string, string)
    ControllerBase.RedirectToPage(string, string, object)
    ControllerBase.RedirectToPage(string, string, string)
    ControllerBase.RedirectToPage(string, string, object, string)
    ControllerBase.RedirectToPagePermanent(string)
    ControllerBase.RedirectToPagePermanent(string, object)
    ControllerBase.RedirectToPagePermanent(string, string)
    ControllerBase.RedirectToPagePermanent(string, string, string)
    ControllerBase.RedirectToPagePermanent(string, string, object, string)
    ControllerBase.RedirectToPagePreserveMethod(string, string, object, string)
    ControllerBase.RedirectToPagePermanentPreserveMethod(string, string, object, string)
    ControllerBase.File(byte[], string)
    ControllerBase.File(byte[], string, bool)
    ControllerBase.File(byte[], string, string)
    ControllerBase.File(byte[], string, string, bool)
    ControllerBase.File(byte[], string, DateTimeOffset?, EntityTagHeaderValue)
    ControllerBase.File(byte[], string, DateTimeOffset?, EntityTagHeaderValue, bool)
    ControllerBase.File(byte[], string, string, DateTimeOffset?, EntityTagHeaderValue)
    ControllerBase.File(byte[], string, string, DateTimeOffset?, EntityTagHeaderValue, bool)
    ControllerBase.File(Stream, string)
    ControllerBase.File(Stream, string, bool)
    ControllerBase.File(Stream, string, string)
    ControllerBase.File(Stream, string, string, bool)
    ControllerBase.File(Stream, string, DateTimeOffset?, EntityTagHeaderValue)
    ControllerBase.File(Stream, string, DateTimeOffset?, EntityTagHeaderValue, bool)
    ControllerBase.File(Stream, string, string, DateTimeOffset?, EntityTagHeaderValue)
    ControllerBase.File(Stream, string, string, DateTimeOffset?, EntityTagHeaderValue, bool)
    ControllerBase.File(string, string)
    ControllerBase.File(string, string, bool)
    ControllerBase.File(string, string, string)
    ControllerBase.File(string, string, string, bool)
    ControllerBase.File(string, string, DateTimeOffset?, EntityTagHeaderValue)
    ControllerBase.File(string, string, DateTimeOffset?, EntityTagHeaderValue, bool)
    ControllerBase.File(string, string, string, DateTimeOffset?, EntityTagHeaderValue)
    ControllerBase.File(string, string, string, DateTimeOffset?, EntityTagHeaderValue, bool)
    ControllerBase.PhysicalFile(string, string)
    ControllerBase.PhysicalFile(string, string, bool)
    ControllerBase.PhysicalFile(string, string, string)
    ControllerBase.PhysicalFile(string, string, string, bool)
    ControllerBase.PhysicalFile(string, string, DateTimeOffset?, EntityTagHeaderValue)
    ControllerBase.PhysicalFile(string, string, DateTimeOffset?, EntityTagHeaderValue, bool)
    ControllerBase.PhysicalFile(string, string, string, DateTimeOffset?, EntityTagHeaderValue)
    ControllerBase.PhysicalFile(string, string, string, DateTimeOffset?, EntityTagHeaderValue, bool)
    ControllerBase.Unauthorized()
    ControllerBase.Unauthorized(object)
    ControllerBase.NotFound()
    ControllerBase.NotFound(object)
    ControllerBase.BadRequest()
    ControllerBase.BadRequest(object)
    ControllerBase.BadRequest(ModelStateDictionary)
    ControllerBase.UnprocessableEntity()
    ControllerBase.UnprocessableEntity(object)
    ControllerBase.UnprocessableEntity(ModelStateDictionary)
    ControllerBase.Conflict()
    ControllerBase.Conflict(object)
    ControllerBase.Conflict(ModelStateDictionary)
    ControllerBase.Problem(string, string, int?, string, string)
    ControllerBase.ValidationProblem(ValidationProblemDetails)
    ControllerBase.ValidationProblem(ModelStateDictionary)
    ControllerBase.ValidationProblem()
    ControllerBase.ValidationProblem(string, string, int?, string, string, ModelStateDictionary)
    ControllerBase.Created()
    ControllerBase.Created(string, object)
    ControllerBase.Created(Uri, object)
    ControllerBase.CreatedAtAction(string, object)
    ControllerBase.CreatedAtAction(string, object, object)
    ControllerBase.CreatedAtAction(string, string, object, object)
    ControllerBase.CreatedAtRoute(string, object)
    ControllerBase.CreatedAtRoute(object, object)
    ControllerBase.CreatedAtRoute(string, object, object)
    ControllerBase.Accepted()
    ControllerBase.Accepted(object)
    ControllerBase.Accepted(Uri)
    ControllerBase.Accepted(string)
    ControllerBase.Accepted(string, object)
    ControllerBase.Accepted(Uri, object)
    ControllerBase.AcceptedAtAction(string)
    ControllerBase.AcceptedAtAction(string, string)
    ControllerBase.AcceptedAtAction(string, object)
    ControllerBase.AcceptedAtAction(string, string, object)
    ControllerBase.AcceptedAtAction(string, object, object)
    ControllerBase.AcceptedAtAction(string, string, object, object)
    ControllerBase.AcceptedAtRoute(object)
    ControllerBase.AcceptedAtRoute(string)
    ControllerBase.AcceptedAtRoute(string, object)
    ControllerBase.AcceptedAtRoute(object, object)
    ControllerBase.AcceptedAtRoute(string, object, object)
    ControllerBase.Challenge()
    ControllerBase.Challenge(params string[])
    ControllerBase.Challenge(AuthenticationProperties)
    ControllerBase.Challenge(AuthenticationProperties, params string[])
    ControllerBase.Forbid()
    ControllerBase.Forbid(params string[])
    ControllerBase.Forbid(AuthenticationProperties)
    ControllerBase.Forbid(AuthenticationProperties, params string[])
    ControllerBase.SignIn(ClaimsPrincipal)
    ControllerBase.SignIn(ClaimsPrincipal, string)
    ControllerBase.SignIn(ClaimsPrincipal, AuthenticationProperties)
    ControllerBase.SignIn(ClaimsPrincipal, AuthenticationProperties, string)
    ControllerBase.SignOut()
    ControllerBase.SignOut(AuthenticationProperties)
    ControllerBase.SignOut(params string[])
    ControllerBase.SignOut(AuthenticationProperties, params string[])
    ControllerBase.TryUpdateModelAsync<TModel>(TModel)
    ControllerBase.TryUpdateModelAsync<TModel>(TModel, string)
    ControllerBase.TryUpdateModelAsync<TModel>(TModel, string, IValueProvider)
    ControllerBase.TryUpdateModelAsync<TModel>(TModel, string, params Expression<Func<TModel, object>>[])
    ControllerBase.TryUpdateModelAsync<TModel>(TModel, string, Func<ModelMetadata, bool>)
    ControllerBase.TryUpdateModelAsync<TModel>(TModel, string, IValueProvider, params Expression<Func<TModel, object>>[])
    ControllerBase.TryUpdateModelAsync<TModel>(TModel, string, IValueProvider, Func<ModelMetadata, bool>)
    ControllerBase.TryUpdateModelAsync(object, Type, string)
    ControllerBase.TryUpdateModelAsync(object, Type, string, IValueProvider, Func<ModelMetadata, bool>)
    ControllerBase.TryValidateModel(object)
    ControllerBase.TryValidateModel(object, string)
    ControllerBase.HttpContext
    ControllerBase.Request
    ControllerBase.Response
    ControllerBase.RouteData
    ControllerBase.ModelState
    ControllerBase.ControllerContext
    ControllerBase.MetadataProvider
    ControllerBase.ModelBinderFactory
    ControllerBase.Url
    ControllerBase.ObjectValidator
    ControllerBase.ProblemDetailsFactory
    ControllerBase.User
    ControllerBase.Empty
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: OEMS.UI.Controllers
    Assembly: OEMS.UI.dll
    Syntax
    [ApiController]
    [Route("api/[controller]")]
    [Authorize]
    public class TemplatesController : ControllerBase

    Constructors

    TemplatesController(ITemplateService, IHttpContextAccessor)

    Initializes a new instance of the TemplatesController class.

    Declaration
    public TemplatesController(ITemplateService templateService, IHttpContextAccessor httpContextAccessor)
    Parameters
    Type Name Description
    ITemplateService templateService

    The template service for template operations.

    IHttpContextAccessor httpContextAccessor

    The HTTP context accessor for accessing request context.

    Methods

    CreateEmailTemplate(CreateEmailTemplateDto)

    Creates a new email template in the system.

    Declaration
    [HttpPost("email")]
    public Task<ActionResult<Guid>> CreateEmailTemplate(CreateEmailTemplateDto dto)
    Parameters
    Type Name Description
    CreateEmailTemplateDto dto

    The data transfer object containing the email template information.

    Returns
    Type Description
    Task<ActionResult<Guid>>

    The unique identifier of the newly created email template.

    Remarks

    This method validates that all required fields are provided (Name, Subject, Body, OrganizationId). The current user must have appropriate permissions for the specified organization.

    CreateProcessStepTemplate(CreateProcessStepTemplateDto)

    Declaration
    [HttpPost("processstep")]
    public Task<ActionResult<Guid>> CreateProcessStepTemplate(CreateProcessStepTemplateDto dto)
    Parameters
    Type Name Description
    CreateProcessStepTemplateDto dto
    Returns
    Type Description
    Task<ActionResult<Guid>>

    CreateProcessTemplate(CreateProcessTemplateDto)

    Declaration
    [HttpPost("process")]
    public Task<ActionResult<Guid>> CreateProcessTemplate(CreateProcessTemplateDto dto)
    Parameters
    Type Name Description
    CreateProcessTemplateDto dto
    Returns
    Type Description
    Task<ActionResult<Guid>>

    DeleteEmailTemplate(Guid)

    Deletes an email template from the system.

    Declaration
    [HttpDelete("email/{id}")]
    public Task<ActionResult> DeleteEmailTemplate(Guid id)
    Parameters
    Type Name Description
    Guid id

    The unique identifier of the email template to delete.

    Returns
    Type Description
    Task<ActionResult>

    No content response if the deletion is successful.

    Remarks

    The current user must have appropriate permissions for the organization that owns the template. Returns 404 Not Found if the template does not exist or the user lacks permissions to access it.

    DeleteProcessStepTemplate(Guid)

    Declaration
    [HttpDelete("processstep/{id}")]
    public Task<ActionResult> DeleteProcessStepTemplate(Guid id)
    Parameters
    Type Name Description
    Guid id
    Returns
    Type Description
    Task<ActionResult>

    DeleteProcessTemplate(Guid)

    Declaration
    [HttpDelete("process/{id}")]
    public Task<ActionResult> DeleteProcessTemplate(Guid id)
    Parameters
    Type Name Description
    Guid id
    Returns
    Type Description
    Task<ActionResult>

    GetEmailTemplate(Guid)

    Retrieves a specific email template by its unique identifier.

    Declaration
    [HttpGet("email/{id}")]
    public Task<ActionResult<EmailTemplateDto>> GetEmailTemplate(Guid id)
    Parameters
    Type Name Description
    Guid id

    The unique identifier of the email template to retrieve.

    Returns
    Type Description
    Task<ActionResult<EmailTemplateDto>>

    The email template with the specified identifier if found.

    Remarks

    This method first attempts to find the template by its ID without organization filtering. If found, it validates that the current user has access to the template's organization. If direct access fails, it falls back to checking each organization the user has access to.

    GetEmailTemplates(Guid)

    Retrieves all email templates for a specific organization.

    Declaration
    [HttpGet("email/organization/{organizationId}")]
    public Task<ActionResult<IEnumerable<EmailTemplateDto>>> GetEmailTemplates(Guid organizationId)
    Parameters
    Type Name Description
    Guid organizationId

    The unique identifier of the organization.

    Returns
    Type Description
    Task<ActionResult<IEnumerable<EmailTemplateDto>>>

    A collection of email templates associated with the specified organization.

    Remarks

    This method retrieves email templates that belong to the specified organization. The user must have appropriate permissions (OrgAdmin, Organizer, or Designer role) for the organization to access its templates.

    GetEventTemplates(Guid)

    Declaration
    [HttpGet("event/organization/{organizationId}")]
    public Task<ActionResult<IEnumerable<EventTemplateDto>>> GetEventTemplates(Guid organizationId)
    Parameters
    Type Name Description
    Guid organizationId
    Returns
    Type Description
    Task<ActionResult<IEnumerable<EventTemplateDto>>>

    GetProcessStepTemplate(Guid)

    Declaration
    [HttpGet("processstep/{id}")]
    public Task<ActionResult<ProcessStepTemplateDto>> GetProcessStepTemplate(Guid id)
    Parameters
    Type Name Description
    Guid id
    Returns
    Type Description
    Task<ActionResult<ProcessStepTemplateDto>>

    GetProcessStepTemplates(Guid)

    Declaration
    [HttpGet("processstep/template/{processTemplateId}")]
    public Task<ActionResult<IEnumerable<ProcessStepTemplateDto>>> GetProcessStepTemplates(Guid processTemplateId)
    Parameters
    Type Name Description
    Guid processTemplateId
    Returns
    Type Description
    Task<ActionResult<IEnumerable<ProcessStepTemplateDto>>>

    GetProcessTemplate(Guid)

    Declaration
    [HttpGet("process/{id}")]
    public Task<ActionResult<ProcessTemplateDto>> GetProcessTemplate(Guid id)
    Parameters
    Type Name Description
    Guid id
    Returns
    Type Description
    Task<ActionResult<ProcessTemplateDto>>

    GetProcessTemplates(Guid)

    Declaration
    [HttpGet("process/organization/{organizationId}")]
    public Task<ActionResult<IEnumerable<ProcessTemplateDto>>> GetProcessTemplates(Guid organizationId)
    Parameters
    Type Name Description
    Guid organizationId
    Returns
    Type Description
    Task<ActionResult<IEnumerable<ProcessTemplateDto>>>

    UpdateEmailTemplate(UpdateEmailTemplateDto)

    Updates an existing email template in the system.

    Declaration
    [HttpPut("email")]
    public Task<ActionResult> UpdateEmailTemplate(UpdateEmailTemplateDto dto)
    Parameters
    Type Name Description
    UpdateEmailTemplateDto dto

    The data transfer object containing the updated email template information.

    Returns
    Type Description
    Task<ActionResult>

    No content response if the update is successful.

    Remarks

    This method validates that all required fields are provided (Id, Name, Subject, Body). The current user must have appropriate permissions for the organization that owns the template. Returns 404 Not Found if the template does not exist or the user lacks permissions to access it.

    UpdateProcessStepTemplate(UpdateProcessStepTemplateDto)

    Declaration
    [HttpPut("processstep")]
    public Task<ActionResult> UpdateProcessStepTemplate(UpdateProcessStepTemplateDto dto)
    Parameters
    Type Name Description
    UpdateProcessStepTemplateDto dto
    Returns
    Type Description
    Task<ActionResult>

    UpdateProcessStepTemplateSequence(Guid, int)

    Declaration
    [HttpPut("processstep/{id}/sequence")]
    public Task<ActionResult> UpdateProcessStepTemplateSequence(Guid id, int newSequence)
    Parameters
    Type Name Description
    Guid id
    int newSequence
    Returns
    Type Description
    Task<ActionResult>

    UpdateProcessTemplate(UpdateProcessTemplateDto)

    Declaration
    [HttpPut("process")]
    public Task<ActionResult> UpdateProcessTemplate(UpdateProcessTemplateDto dto)
    Parameters
    Type Name Description
    UpdateProcessTemplateDto dto
    Returns
    Type Description
    Task<ActionResult>
    In this article
    Back to top Generated by DocFX