phronCare/Core/Services/CustomerService.cs
Leandro Hernan Rojas 4537352054
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 2m55s
Add Search Customer in API
2025-04-04 21:44:20 -03:00

67 lines
1.9 KiB
C#

using System.Reflection;
using Core.Interfaces;
using Domain.Entities;
using Models.Helpers;
using Models.Interfaces;
using Models.Models;
namespace Core.Services
{
public class CustomerService: ICustomerDom
{
#region Declaraciones y Constructor
private readonly IPhSCustomerRepository _repository;
public CustomerService(IPhSCustomerRepository customerRepository)
{
_repository = customerRepository ?? throw new ArgumentNullException(nameof(customerRepository));
}
#endregion
public Task<ECustomer> AddAsync(ECustomer entity)
{
throw new NotImplementedException();
}
public Task<bool> DeleteAsync(int id)
{
throw new NotImplementedException();
}
public async Task<IEnumerable<ECustomer>> GetAllAsync()
{
try
{
return await _repository.GetAllAsync();
}
catch (Exception ex)
{
var methodName = MethodBase.GetCurrentMethod()?.Name ?? "UnknownMethod";
throw new Exception($"{methodName} Message: {ex.Message}", ex);
}
}
public Task<ECustomer?> GetByIdAsync(int id)
{
throw new NotImplementedException();
}
public async Task<IEnumerable<ECustomer>> SearchAsync(string? name, string? email, string? document)
{
try
{
return await _repository.SearchAsync(name, email, document);
}
catch (Exception ex)
{
var methodName = MethodBase.GetCurrentMethod()?.Name ?? "UnknownMethod";
throw new Exception($"{methodName} Message: {ex.Message}", ex);
}
}
public Task<bool> UpdateAsync(ECustomer entity)
{
throw new NotImplementedException();
}
}
}