Class DesignationsController
- Namespace
- KadicErp.WebApi.Controllers.BusinessPartners
- Assembly
- KadicErp.WebApi.dll
[Route("api/designations")]
public class DesignationsController : GenericCrudControllerBase<DesignationDto, CreateDesignationCommand, UpdateDesignationCommand, GetDesignationByIdQuery, GetAllDesignationsQuery>
- Inheritance
-
objectControllerBaseGenericCrudControllerBase<DesignationDto, CreateDesignationCommand, UpdateDesignationCommand, GetDesignationByIdQuery, GetAllDesignationsQuery>DesignationsController
- Inherited Members
-
GenericCrudControllerBase<DesignationDto, CreateDesignationCommand, UpdateDesignationCommand, GetDesignationByIdQuery, GetAllDesignationsQuery>.SenderGenericCrudControllerBase<DesignationDto, CreateDesignationCommand, UpdateDesignationCommand, GetDesignationByIdQuery, GetAllDesignationsQuery>.CreateGetByIdQuery(Guid)GenericCrudControllerBase<DesignationDto, CreateDesignationCommand, UpdateDesignationCommand, GetDesignationByIdQuery, GetAllDesignationsQuery>.CreateGetAllQuery(PaginatorRequestDto, bool?)GenericCrudControllerBase<DesignationDto, CreateDesignationCommand, UpdateDesignationCommand, GetDesignationByIdQuery, GetAllDesignationsQuery>.SetCommandId(UpdateDesignationCommand, Guid)GenericCrudControllerBase<DesignationDto, CreateDesignationCommand, UpdateDesignationCommand, GetDesignationByIdQuery, GetAllDesignationsQuery>.HandleCommandResult(Result)GenericCrudControllerBase<DesignationDto, CreateDesignationCommand, UpdateDesignationCommand, GetDesignationByIdQuery, GetAllDesignationsQuery>.HandleCommandResult<T>(Result<T>, string)GenericCrudControllerBase<DesignationDto, CreateDesignationCommand, UpdateDesignationCommand, GetDesignationByIdQuery, GetAllDesignationsQuery>.Create(CreateDesignationCommand)GenericCrudControllerBase<DesignationDto, CreateDesignationCommand, UpdateDesignationCommand, GetDesignationByIdQuery, GetAllDesignationsQuery>.Update(Guid, UpdateDesignationCommand)GenericCrudControllerBase<DesignationDto, CreateDesignationCommand, UpdateDesignationCommand, GetDesignationByIdQuery, GetAllDesignationsQuery>.GetById(Guid)GenericCrudControllerBase<DesignationDto, CreateDesignationCommand, UpdateDesignationCommand, GetDesignationByIdQuery, GetAllDesignationsQuery>.GetAll(PaginatorRequestDto, bool?)
Constructors
DesignationsController(ISender)
public DesignationsController(ISender sender)
Parameters
senderISender
Methods
Activate(Guid)
[HttpPatch("{id}/activate")]
[Authorize(Policy = "BUSINESS_PARTNERS_DESIGNATIONS_ACTIVATE")]
[ProducesResponseType(200)]
[ProducesResponseType(typeof(Error), 404)]
public Task<IActionResult> Activate(Guid id)
Parameters
idGuid
Returns
- Task<IActionResult>
Create(CreateDesignationCommand)
POST endpoint for creating a new entity. Returns 201 Created with Location header on success.
IMPORTANT: Override in derived class to add [HttpPost] and [Authorize(Policy = ...)]
[HttpPost]
[Authorize(Policy = "BUSINESS_PARTNERS_DESIGNATIONS_CREATE")]
public override Task<IActionResult> Create(CreateDesignationCommand command)
Parameters
commandCreateDesignationCommand
Returns
- Task<IActionResult>
Deactivate(Guid)
[HttpPatch("{id}/deactivate")]
[Authorize(Policy = "BUSINESS_PARTNERS_DESIGNATIONS_DEACTIVATE")]
[ProducesResponseType(200)]
[ProducesResponseType(typeof(Error), 404)]
public Task<IActionResult> Deactivate(Guid id)
Parameters
idGuid
Returns
- Task<IActionResult>
GetAll(PaginatorRequestDto, bool?)
GET endpoint for retrieving paginated list of entities. Supports optional isActive filter.
IMPORTANT: Override in derived class to add [HttpGet] and [Authorize(Policy = ...)] Override CreateGetAllQuery if you need additional filters. Note: ProducesResponseType attributes cannot be added here due to generic type parameters. Add them in derived class if needed for Swagger documentation.
[HttpGet]
[Authorize(Policy = "BUSINESS_PARTNERS_DESIGNATIONS_VIEW")]
public override Task<IActionResult> GetAll(PaginatorRequestDto paginator, bool? isActive = null)
Parameters
paginatorPaginatorRequestDtoisActivebool?
Returns
- Task<IActionResult>
GetById(Guid)
GET endpoint for retrieving a single entity by ID. Returns 404 Not Found if entity doesn't exist.
IMPORTANT: Override in derived class to add [HttpGet("{id}")] and [Authorize(Policy = ...)] Note: ProducesResponseType attributes cannot be added here due to generic type parameters. Add them in derived class if needed for Swagger documentation.
[HttpGet("{id}")]
[Authorize(Policy = "BUSINESS_PARTNERS_DESIGNATIONS_VIEW")]
public override Task<IActionResult> GetById(Guid id)
Parameters
idGuid
Returns
- Task<IActionResult>
SetCommandId(UpdateDesignationCommand, Guid)
Updates the command with the ID from route. This method must be overridden in derived classes to properly set the Id.
For record types with 'with' expression, use:
protected override UpdateXCommand SetCommandId(UpdateXCommand command, Guid id)
=> command with { Id = id };
protected override UpdateDesignationCommand SetCommandId(UpdateDesignationCommand command, Guid id)
Parameters
commandUpdateDesignationCommandidGuid
Returns
- UpdateDesignationCommand
Update(Guid, UpdateDesignationCommand)
PUT endpoint for updating an existing entity. Returns 200 OK on success.
IMPORTANT: Override in derived class to add [HttpPut("{id}")] and [Authorize(Policy = ...)]
[HttpPut("{id}")]
[Authorize(Policy = "BUSINESS_PARTNERS_DESIGNATIONS_UPDATE")]
public override Task<IActionResult> Update(Guid id, UpdateDesignationCommand command)
Parameters
idGuidcommandUpdateDesignationCommand
Returns
- Task<IActionResult>