phronCare/Core/Services/CustomerService.cs

71 lines
2.0 KiB
C#
Raw Normal View History

2025-04-04 14:58:44 -03:00
using System.Reflection;
using Core.Interfaces;
using Domain.Entities;
2025-04-06 01:19:47 -03:00
using Domain.Generics;
2025-04-04 14:58:44 -03:00
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();
}
2025-04-06 01:19:47 -03:00
public async Task<PagedResult<ECustomer>> SearchAsync(string? name, string? email, string? document, int page, int pageSize)
2025-04-04 14:58:44 -03:00
{
2025-04-04 21:44:20 -03:00
try
{
2025-04-06 01:19:47 -03:00
return await _repository.SearchAsync(name, email, document, page, pageSize);
2025-04-04 21:44:20 -03:00
}
catch (Exception ex)
{
var methodName = MethodBase.GetCurrentMethod()?.Name ?? "UnknownMethod";
throw new Exception($"{methodName} Message: {ex.Message}", ex);
}
2025-04-04 14:58:44 -03:00
}
2025-04-06 01:19:47 -03:00
2025-04-04 14:58:44 -03:00
public Task<bool> UpdateAsync(ECustomer entity)
{
throw new NotImplementedException();
}
}
}