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