Spaces:
Runtime error
Runtime error
Download src/SCM.Api/Controllers/ItensControleController.cs from rafaeldavila/scm-api: direct link, hf CLI and curl.
- Browser
- Download file 3.43 kB
-
https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Api/Controllers/ItensControleController.cs
- Command line
-
hf download hf://spaces/rafaeldavila/scm-api/src/SCM.Api/Controllers/ItensControleController.cs
-
curl -L -o ItensControleController.cs https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Api/Controllers/ItensControleController.cs
3.43 kB
| using Asp.Versioning; | |
| using Microsoft.AspNetCore.Authorization; | |
| using Microsoft.AspNetCore.Mvc; | |
| using SCM.Application.Controle; | |
| using SCM.Application.Controle.Dtos; | |
| using SCM.Shared.Api; | |
| using SCM.Shared.Constants; | |
| namespace SCM.Api.Controllers; | |
| /// <summary>Módulo MBC — itens de controle.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public sealed class ItensControleController : ControllerBase | |
| { | |
| private readonly IItemControleService _service; | |
| public ItensControleController(IItemControleService service) => _service = service; | |
| /// <summary>Lista os itens de controle de uma obra (ordenados por código).</summary> | |
| [] | |
| [] | |
| public async Task<ActionResult<IReadOnlyList<ItemControleResponse>>> GetByObra( | |
| [] Guid obraId, CancellationToken ct = default) | |
| => Ok(await _service.GetByObraAsync(obraId, ct)); | |
| /// <summary>Obtém um item de controle pelo identificador.</summary> | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<ItemControleResponse>> GetById(Guid id, CancellationToken ct = default) | |
| => Ok(await _service.GetByIdAsync(id, ct)); | |
| /// <summary>Cria um item de controle.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<ItemControleResponse>> Create( | |
| [] CreateItemControleRequest request, CancellationToken ct = default) | |
| { | |
| var created = await _service.CreateAsync(request, ct); | |
| return CreatedAtAction(nameof(GetById), new { id = created.Id, version = "1.0" }, created); | |
| } | |
| /// <summary>Altera um item de controle.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<ItemControleResponse>> Update( | |
| Guid id, [FromBody] UpdateItemControleRequest request, CancellationToken ct = default) | |
| => Ok(await _service.UpdateAsync(id, request, ct)); | |
| /// <summary>Exclui um item de controle (bloqueado se possuir itens programados).</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<IActionResult> Delete(Guid id, CancellationToken ct = default) | |
| { | |
| await _service.DeleteAsync(id, ct); | |
| return NoContent(); | |
| } | |
| } | |