phronCare/Core/Services/TaxConditionService.cs
Leandro Hernan Rojas 42e67d5600
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 5m18s
Update TaxCondition Endpoint in API
2025-04-10 16:14:53 -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 TaxConditionService : ITaxConditionDom
{
#region Declaraciones y Constructor
private readonly IPhSTaxConditionRepository _repository;
public TaxConditionService(IPhSTaxConditionRepository repository)
{
_repository = repository ?? throw new ArgumentNullException(nameof(repository));
}
#endregion
#region Metodos de clase
public async Task<IEnumerable<ETaxCondition>> 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<ETaxCondition?> 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
}
}