diff --git a/Models/Repositories/PhSCustomerRepository.cs b/Models/Repositories/PhSCustomerRepository.cs index a4b5f22..98c4a2f 100644 --- a/Models/Repositories/PhSCustomerRepository.cs +++ b/Models/Repositories/PhSCustomerRepository.cs @@ -1,5 +1,6 @@ using Domain.Entities; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; using Models.Helpers; using Models.Interfaces; using Models.Models; @@ -7,10 +8,12 @@ using System.Xml.Linq; namespace Models.Repositories { - public class PhSCustomerRepository(PhronCareOperationsHubContext context) : IPhSCustomerRepository + public class PhSCustomerRepository(PhronCareOperationsHubContext context, ILogger logger) : IPhSCustomerRepository { #region Declaraciones y Constructor private readonly PhronCareOperationsHubContext _context = context; + private readonly ILogger _logger = logger; + #endregion public async Task> GetAllAsync() { @@ -56,12 +59,13 @@ namespace Models.Repositories // c.PhSCustomerDocuments.Any(a => // EF.Functions.Like(a.DocumentNumber.ToLower(), $"%{loweredDoc}%"))); //} - if (!string.IsNullOrWhiteSpace(document)) + _logger.LogDebug("VALOR RECIBIDO DE 'document': {document}", document); + if (!string.IsNullOrWhiteSpace(document) && document != "?") { var loweredDoc = document.ToLower(); query = query.Where(c => c.PhSCustomerDocuments.Any(a => - a.DocumentNumber.ToLower().Contains(loweredDoc))); + EF.Functions.Like(a.DocumentNumber.ToLower(), $"%{loweredDoc}%"))); } //if (!string.IsNullOrWhiteSpace(email)) //{