Primera subida

This commit is contained in:
Alejandro Sarmiento
2024-04-06 03:32:16 +02:00
parent c97b4a8179
commit b672887299
44 changed files with 44426 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
using back.Application.Contracts.Services;
using back.Application.Services;
using back.Entities.DTOs.Request;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace back.Controllers
{
[Route("api/v1/[controller]")]
[ApiController]
public class PersonaController : ControllerBase
{
private readonly PersonaService service;
public PersonaController(PersonaService _service)
{
service = _service;
}
[HttpGet("GetOne/{id}")]
public async Task<IActionResult> GetOne(int id)
{
return Ok(await service.GetOne(id));
}
[HttpGet("GetAll")]
public async Task<IActionResult> GetAll()
{
return Ok(await service.GetAll());
}
[HttpPost("Create")]
public async Task<IActionResult> Create(PersonaRequestDto dto)
{
return Ok(await service.Add(dto));
}
[HttpPut("Update")]
public async Task<IActionResult> Update(PersonaUpdateRequestDto dto)
{
return Ok(await service.Update(dto));
}
[HttpDelete("Delete/{id}")]
public async Task<IActionResult> Delete(int id)
{
return Ok(service.Delete(id));
}
}
}