Table of Contents

Class DepartmentsController

Namespace
KadicErp.WebApi.Controllers.Purchase
Assembly
KadicErp.WebApi.dll
[ApiController]
[Route("api/purchase/departments")]
[Authorize]
public class DepartmentsController : ControllerBase
Inheritance
object
ControllerBase
DepartmentsController

Constructors

DepartmentsController(IMediator, ICurrentUser)

public DepartmentsController(IMediator mediator, ICurrentUser currentUser)

Parameters

mediator IMediator
currentUser ICurrentUser

Methods

Activate(Guid)

[HttpPatch("{id}/activate")]
[ProducesResponseType(200)]
[ProducesResponseType(typeof(Error), 404)]
[Authorize(Policy = "PURCHASE_DEPARTMENTS_ACTIVATE")]
public Task<IActionResult> Activate(Guid id)

Parameters

id Guid

Returns

Task<IActionResult>

Create(CreateDepartmentRequest)

[HttpPost]
[ProducesResponseType(typeof(Guid), 201)]
[ProducesResponseType(typeof(Error), 400)]
[ProducesResponseType(typeof(Error), 409)]
[Authorize(Policy = "PURCHASE_DEPARTMENTS_CREATE")]
public Task<IActionResult> Create(CreateDepartmentRequest request)

Parameters

request CreateDepartmentRequest

Returns

Task<IActionResult>

Deactivate(Guid)

[HttpPatch("{id}/deactivate")]
[ProducesResponseType(200)]
[ProducesResponseType(typeof(Error), 404)]
[Authorize(Policy = "PURCHASE_DEPARTMENTS_DEACTIVATE")]
public Task<IActionResult> Deactivate(Guid id)

Parameters

id Guid

Returns

Task<IActionResult>

GetAll(PaginatorRequestDto, bool?, string?, string?)

[HttpGet]
[ProducesResponseType(typeof(PaginatorResponseDto<DepartmentDto>), 200)]
[Authorize(Policy = "PURCHASE_DEPARTMENTS_VIEW")]
public Task<IActionResult> GetAll(PaginatorRequestDto request, bool? isActive = null, string? code = null, string? name = null)

Parameters

request PaginatorRequestDto
isActive bool?
code string
name string

Returns

Task<IActionResult>

GetById(Guid)

[HttpGet("{id}")]
[ProducesResponseType(typeof(DepartmentDto), 200)]
[ProducesResponseType(typeof(Error), 404)]
[Authorize(Policy = "PURCHASE_DEPARTMENTS_VIEW")]
public Task<ActionResult<DepartmentDto>> GetById(Guid id)

Parameters

id Guid

Returns

Task<ActionResult<DepartmentDto>>

Update(Guid, UpdateDepartmentCommand)

[HttpPut("{id}")]
[ProducesResponseType(200)]
[ProducesResponseType(typeof(Error), 400)]
[ProducesResponseType(typeof(Error), 404)]
[Authorize(Policy = "PURCHASE_DEPARTMENTS_UPDATE")]
public Task<IActionResult> Update(Guid id, UpdateDepartmentCommand command)

Parameters

id Guid
command UpdateDepartmentCommand

Returns

Task<IActionResult>