Class StockTransferLinesController
- Namespace
- KadicErp.WebApi.Controllers.Inventory
- Assembly
- KadicErp.WebApi.dll
[Route("api/inventory/stock-transfer-lines")]
[Authorize]
public class StockTransferLinesController : GenericCrudControllerBase<StockTransferLineDto, CreateStockTransferLineCommand, UpdateStockTransferLineCommand, GetStockTransferLineByIdQuery, GetStockTransferLinesQuery>
- Inheritance
-
objectControllerBaseGenericCrudControllerBase<StockTransferLineDto, CreateStockTransferLineCommand, UpdateStockTransferLineCommand, GetStockTransferLineByIdQuery, GetStockTransferLinesQuery>StockTransferLinesController
- Inherited Members
-
GenericCrudControllerBase<StockTransferLineDto, CreateStockTransferLineCommand, UpdateStockTransferLineCommand, GetStockTransferLineByIdQuery, GetStockTransferLinesQuery>.SenderGenericCrudControllerBase<StockTransferLineDto, CreateStockTransferLineCommand, UpdateStockTransferLineCommand, GetStockTransferLineByIdQuery, GetStockTransferLinesQuery>.CreateGetByIdQuery(Guid)GenericCrudControllerBase<StockTransferLineDto, CreateStockTransferLineCommand, UpdateStockTransferLineCommand, GetStockTransferLineByIdQuery, GetStockTransferLinesQuery>.CreateGetAllQuery(PaginatorRequestDto, bool?)GenericCrudControllerBase<StockTransferLineDto, CreateStockTransferLineCommand, UpdateStockTransferLineCommand, GetStockTransferLineByIdQuery, GetStockTransferLinesQuery>.SetCommandId(UpdateStockTransferLineCommand, Guid)GenericCrudControllerBase<StockTransferLineDto, CreateStockTransferLineCommand, UpdateStockTransferLineCommand, GetStockTransferLineByIdQuery, GetStockTransferLinesQuery>.HandleCommandResult(Result)GenericCrudControllerBase<StockTransferLineDto, CreateStockTransferLineCommand, UpdateStockTransferLineCommand, GetStockTransferLineByIdQuery, GetStockTransferLinesQuery>.HandleCommandResult<T>(Result<T>, string)GenericCrudControllerBase<StockTransferLineDto, CreateStockTransferLineCommand, UpdateStockTransferLineCommand, GetStockTransferLineByIdQuery, GetStockTransferLinesQuery>.Create(CreateStockTransferLineCommand)GenericCrudControllerBase<StockTransferLineDto, CreateStockTransferLineCommand, UpdateStockTransferLineCommand, GetStockTransferLineByIdQuery, GetStockTransferLinesQuery>.Update(Guid, UpdateStockTransferLineCommand)GenericCrudControllerBase<StockTransferLineDto, CreateStockTransferLineCommand, UpdateStockTransferLineCommand, GetStockTransferLineByIdQuery, GetStockTransferLinesQuery>.GetById(Guid)GenericCrudControllerBase<StockTransferLineDto, CreateStockTransferLineCommand, UpdateStockTransferLineCommand, GetStockTransferLineByIdQuery, GetStockTransferLinesQuery>.GetAll(PaginatorRequestDto, bool?)
Constructors
StockTransferLinesController(ISender, ICurrentUser, ITenantIdContext, IStringLocalizer<GeneralMessages>)
public StockTransferLinesController(ISender sender, ICurrentUser currentUser, ITenantIdContext tenantContext, IStringLocalizer<GeneralMessages> localizer)
Parameters
senderISendercurrentUserICurrentUsertenantContextITenantIdContextlocalizerIStringLocalizer<GeneralMessages>
Methods
Create(CreateStockTransferLineCommand)
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 = "INVENTORY_STOCK_TRANSFER_LINES_CREATE")]
[ProducesResponseType(typeof(Result<Guid>), 201)]
[ProducesResponseType(typeof(Result), 400)]
[ProducesResponseType(typeof(Result), 409)]
public override Task<IActionResult> Create(CreateStockTransferLineCommand command)
Parameters
commandCreateStockTransferLineCommand
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.
[NonAction]
public override Task<IActionResult> GetAll(PaginatorRequestDto paginator, bool? isActive = null)
Parameters
paginatorPaginatorRequestDtoisActivebool?
Returns
- Task<IActionResult>
GetAll(PaginatorRequestDto, CancellationToken)
[HttpGet]
[Authorize(Policy = "INVENTORY_STOCK_TRANSFER_LINES_VIEW")]
[ProducesResponseType(typeof(PaginatorResponseDto<StockTransferLineDto>), 200)]
[ProducesResponseType(typeof(Error), 400)]
public Task<IActionResult> GetAll(PaginatorRequestDto paginator, CancellationToken cancellationToken = default)
Parameters
paginatorPaginatorRequestDtocancellationTokenCancellationToken
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:guid}")]
[Authorize(Policy = "INVENTORY_STOCK_TRANSFER_LINES_VIEW")]
[ProducesResponseType(typeof(StockTransferLineDto), 200)]
[ProducesResponseType(typeof(Error), 404)]
public override Task<IActionResult> GetById(Guid id)
Parameters
idGuid
Returns
- Task<IActionResult>
SetCommandId(UpdateStockTransferLineCommand, 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 UpdateStockTransferLineCommand SetCommandId(UpdateStockTransferLineCommand command, Guid id)
Parameters
commandUpdateStockTransferLineCommandidGuid
Returns
- UpdateStockTransferLineCommand
Update(Guid, UpdateStockTransferLineCommand)
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:guid}")]
[Authorize(Policy = "INVENTORY_STOCK_TRANSFER_LINES_UPDATE")]
[ProducesResponseType(typeof(Result), 200)]
[ProducesResponseType(typeof(Result), 400)]
[ProducesResponseType(typeof(Result), 404)]
[ProducesResponseType(typeof(Result), 409)]
public override Task<IActionResult> Update(Guid id, UpdateStockTransferLineCommand command)
Parameters
idGuidcommandUpdateStockTransferLineCommand
Returns
- Task<IActionResult>