Table of Contents

Class PaymentTypeController

Namespace
KadicErp.WebApi.Controllers.Sales.ReferenceData
Assembly
KadicErp.WebApi.dll
[Route("api/[controller]")]
[Authorize]
public class PaymentTypeController : GenericCrudControllerBase<PaymentTypeDto, CreatePaymentTypeCommand, UpdatePaymentTypeCommand, GetPaymentTypeByIdQuery, GetAllCompanyTypeQuery>
Inheritance
object
ControllerBase
GenericCrudControllerBase<PaymentTypeDto, CreatePaymentTypeCommand, UpdatePaymentTypeCommand, GetPaymentTypeByIdQuery, GetAllCompanyTypeQuery>
PaymentTypeController
Inherited Members
GenericCrudControllerBase<PaymentTypeDto, CreatePaymentTypeCommand, UpdatePaymentTypeCommand, GetPaymentTypeByIdQuery, GetAllCompanyTypeQuery>.Sender
GenericCrudControllerBase<PaymentTypeDto, CreatePaymentTypeCommand, UpdatePaymentTypeCommand, GetPaymentTypeByIdQuery, GetAllCompanyTypeQuery>.CreateGetByIdQuery(Guid)
GenericCrudControllerBase<PaymentTypeDto, CreatePaymentTypeCommand, UpdatePaymentTypeCommand, GetPaymentTypeByIdQuery, GetAllCompanyTypeQuery>.CreateGetAllQuery(PaginatorRequestDto, bool?)
GenericCrudControllerBase<PaymentTypeDto, CreatePaymentTypeCommand, UpdatePaymentTypeCommand, GetPaymentTypeByIdQuery, GetAllCompanyTypeQuery>.SetCommandId(UpdatePaymentTypeCommand, Guid)
GenericCrudControllerBase<PaymentTypeDto, CreatePaymentTypeCommand, UpdatePaymentTypeCommand, GetPaymentTypeByIdQuery, GetAllCompanyTypeQuery>.HandleCommandResult(Result)
GenericCrudControllerBase<PaymentTypeDto, CreatePaymentTypeCommand, UpdatePaymentTypeCommand, GetPaymentTypeByIdQuery, GetAllCompanyTypeQuery>.HandleCommandResult<T>(Result<T>, string)
GenericCrudControllerBase<PaymentTypeDto, CreatePaymentTypeCommand, UpdatePaymentTypeCommand, GetPaymentTypeByIdQuery, GetAllCompanyTypeQuery>.Create(CreatePaymentTypeCommand)
GenericCrudControllerBase<PaymentTypeDto, CreatePaymentTypeCommand, UpdatePaymentTypeCommand, GetPaymentTypeByIdQuery, GetAllCompanyTypeQuery>.Update(Guid, UpdatePaymentTypeCommand)
GenericCrudControllerBase<PaymentTypeDto, CreatePaymentTypeCommand, UpdatePaymentTypeCommand, GetPaymentTypeByIdQuery, GetAllCompanyTypeQuery>.GetById(Guid)
GenericCrudControllerBase<PaymentTypeDto, CreatePaymentTypeCommand, UpdatePaymentTypeCommand, GetPaymentTypeByIdQuery, GetAllCompanyTypeQuery>.GetAll(PaginatorRequestDto, bool?)

Constructors

PaymentTypeController(ISender)

public PaymentTypeController(ISender sender)

Parameters

sender ISender

Methods

Activate(Guid)

[HttpPatch("{id}/activate")]
[Authorize(Policy = "SALES_PAYMENT_TYPE_ACTIVATE")]
public Task<IActionResult> Activate(Guid id)

Parameters

id Guid

Returns

Task<IActionResult>

Create(CreatePaymentTypeCommand)

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 = "SALES_PAYMENT_TYPE_CREATE")]
public override Task<IActionResult> Create(CreatePaymentTypeCommand command)

Parameters

command CreatePaymentTypeCommand

Returns

Task<IActionResult>

Deactivate(Guid)

[HttpPatch("{id}/deactivate")]
[Authorize(Policy = "SALES_PAYMENT_TYPE_DEACTIVATE")]
public Task<IActionResult> Deactivate(Guid id)

Parameters

id Guid

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 = "SALES_PAYMENT_TYPE_VIEW")]
public override Task<IActionResult> GetAll(PaginatorRequestDto paginator, bool? isActive = null)

Parameters

paginator PaginatorRequestDto
isActive bool?

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 = "SALES_PAYMENT_TYPE_VIEW")]
public override Task<IActionResult> GetById(Guid id)

Parameters

id Guid

Returns

Task<IActionResult>

SetCommandId(UpdatePaymentTypeCommand, 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 UpdatePaymentTypeCommand SetCommandId(UpdatePaymentTypeCommand command, Guid id)

Parameters

command UpdatePaymentTypeCommand
id Guid

Returns

UpdatePaymentTypeCommand

Update(Guid, UpdatePaymentTypeCommand)

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 = "SALES_PAYMENT_TYPE_UPDATE")]
public override Task<IActionResult> Update(Guid id, UpdatePaymentTypeCommand command)

Parameters

id Guid
command UpdatePaymentTypeCommand

Returns

Task<IActionResult>