All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 5m18s
41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using Core.Interfaces;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace phronCare.API.Controllers.Sales
|
|
{
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class TaxConditionController : ControllerBase
|
|
{
|
|
private readonly ITaxConditionDom _taxConditionService ;
|
|
public TaxConditionController(ITaxConditionDom taxConditionService)
|
|
{
|
|
_taxConditionService = taxConditionService ?? throw new ArgumentNullException(nameof(taxConditionService));
|
|
}
|
|
[HttpGet("GetAll")]
|
|
public async Task<IActionResult> GetAll()
|
|
{
|
|
try
|
|
{
|
|
var result = await _taxConditionService.GetAllAsync();
|
|
return Ok(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return BadRequest(ex.Message);
|
|
}
|
|
}
|
|
[HttpGet("GetByName/{name}")]
|
|
public async Task<IActionResult> GetByName(string name)
|
|
{
|
|
var result = await _taxConditionService.GetByNameAsync(name);
|
|
if (result == null)
|
|
return NotFound($"No se encontró un tipo de cuenta con el nombre '{name}'.");
|
|
|
|
return Ok(result);
|
|
}
|
|
|
|
}
|
|
}
|