Primera subida
This commit is contained in:
52
back/Controllers/CasaController.cs
Normal file
52
back/Controllers/CasaController.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
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 CasaController : ControllerBase
|
||||
{
|
||||
private readonly CasaService service;
|
||||
|
||||
public CasaController(CasaService service)
|
||||
{
|
||||
this.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(CasaRequestDto dto)
|
||||
{
|
||||
if(dto.Direction == null)
|
||||
{
|
||||
return BadRequest("Direccion debe existir");
|
||||
}
|
||||
return Ok(await service.Add(dto));
|
||||
}
|
||||
|
||||
[HttpPut("Update")]
|
||||
public async Task<IActionResult> Update(CasaUpdateRequestDto dto)
|
||||
{
|
||||
return Ok(await service.Update(dto));
|
||||
}
|
||||
|
||||
[HttpDelete("Delete/{id}")]
|
||||
public async Task<IActionResult> Delete(int id)
|
||||
{
|
||||
return Ok(service.Delete(id));
|
||||
}
|
||||
}
|
||||
}
|
||||
48
back/Controllers/DireccionController.cs
Normal file
48
back/Controllers/DireccionController.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using back.Application.Services;
|
||||
using back.Entities.DTOs.Request;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace back.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class DireccionController : ControllerBase
|
||||
{
|
||||
private readonly DireccionService service;
|
||||
|
||||
public DireccionController(DireccionService service)
|
||||
{
|
||||
this.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(DireccionRequestDto dto)
|
||||
//{
|
||||
// return Ok(await service.Add(dto));
|
||||
//}
|
||||
|
||||
[HttpPut("Update")]
|
||||
public async Task<IActionResult> Update(DireccionUpdateRequestDto dto)
|
||||
{
|
||||
return Ok(await service.Update(dto));
|
||||
}
|
||||
|
||||
//[HttpDelete("Delete/{id}")]
|
||||
//public async Task<IActionResult> Delete(int id)
|
||||
//{
|
||||
// return Ok(service.Delete(id));
|
||||
//}
|
||||
}
|
||||
}
|
||||
31
back/Controllers/IWantItAllController.cs
Normal file
31
back/Controllers/IWantItAllController.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using back.Application.Contracts.Services;
|
||||
using back.Application.Services;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace back.Controllers
|
||||
{
|
||||
[Route("api/v1/[controller]")]
|
||||
[ApiController]
|
||||
public class IWantItAllController : ControllerBase
|
||||
{
|
||||
private readonly IWantItAllService service;
|
||||
|
||||
public IWantItAllController(IWantItAllService _service)
|
||||
{
|
||||
service = _service;
|
||||
}
|
||||
|
||||
[HttpGet("GetAllAsyncAwait")]
|
||||
public async Task<IActionResult> GetAllAsyncAwait()
|
||||
{
|
||||
return Ok(await service.GetWithAsyncAwait());
|
||||
}
|
||||
|
||||
[HttpGet("GetAllTasks")]
|
||||
public async Task<IActionResult> GetAllTasks()
|
||||
{
|
||||
return Ok(await service.GetWithTasks());
|
||||
}
|
||||
}
|
||||
}
|
||||
50
back/Controllers/PersonaController.cs
Normal file
50
back/Controllers/PersonaController.cs
Normal 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
11
back/Controllers/TimeTester.cs
Normal file
11
back/Controllers/TimeTester.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace back.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class TimeTester : ControllerBase
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user