phronCare/Core/Services/ProfessionalSpecialtyService.cs
Leandro Hernan Rojas f4d6bd9e28
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 5m31s
Add Professional y Specialty on API UI
2025-04-24 20:03:42 -03:00

44 lines
1.4 KiB
C#

using Core.Interfaces;
using Domain.Entities;
using Models.Interfaces;
using System.Reflection;
namespace Core.Services
{
public class ProfessionalSpecialtyService : IProfessionalSpecialtyDom
{
#region Declaraciones y Constructor
private readonly IPhSProfessionalSpecialtyRepository _repository;
public ProfessionalSpecialtyService(IPhSProfessionalSpecialtyRepository repository)
{
_repository = repository ?? throw new ArgumentNullException(nameof(repository));
}
#endregion
#region Metodos de clase
public async Task<IEnumerable<EProfessionalSpecialty>> GetAllAsync()
{
try
{
return await _repository.GetAllAsync();
}
catch (Exception ex)
{
var methodName = MethodBase.GetCurrentMethod()?.Name ?? "UnknownMethod";
throw new Exception($"{methodName} Message: {ex.Message}", ex);
}
}
public async Task<EProfessionalSpecialty?> GetByNameAsync(string name)
{
try
{
return await _repository.GetByNameAsync(name);
}
catch (Exception ex)
{
var methodName = MethodBase.GetCurrentMethod()?.Name ?? "UnknownMethod";
throw new Exception($"{methodName} Message: {ex.Message}", ex);
}
}
#endregion
}
}