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 GetAll() { try { var result = await _taxConditionService.GetAllAsync(); return Ok(result); } catch (Exception ex) { return BadRequest(ex.Message); } } [HttpGet("GetByName/{name}")] public async Task 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); } } }