Add Patch in CustomerController
Some checks failed
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Failing after 43s
Some checks failed
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Failing after 43s
This commit is contained in:
parent
f61f26c98b
commit
143c3b45e7
@ -42,7 +42,7 @@ namespace Models.Repositories
|
||||
.Include(c => c.Accounttypes)
|
||||
.Include(c => c.PhSCustomerDocuments)
|
||||
.Include(c => c.PhSCustomerAddresses)
|
||||
.Take(3)
|
||||
.Take(100)
|
||||
.AsQueryable();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(name))
|
||||
@ -53,12 +53,6 @@ namespace Models.Repositories
|
||||
c.BusinessName.ToLower().Contains(loweredName));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(document) && document != "?")
|
||||
{
|
||||
query = query.Where(c =>
|
||||
c.PhSCustomerDocuments.Any(a =>
|
||||
EF.Functions.Like(a.DocumentNumber, $"%{document}%")));
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(email))
|
||||
{
|
||||
var loweredEmail = email.ToLower();
|
||||
@ -67,6 +61,13 @@ namespace Models.Repositories
|
||||
a.Email.ToLower().Contains(loweredEmail)));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(document) && document != "?")
|
||||
{
|
||||
query = query.Where(c =>
|
||||
c.PhSCustomerDocuments.Any(a =>
|
||||
EF.Functions.Like(a.DocumentNumber, $"%{document}%")));
|
||||
}
|
||||
|
||||
var customers = await query.ToListAsync();
|
||||
|
||||
Console.WriteLine($"VALOR RECIBIDO DE 'name': {name}");
|
||||
|
||||
@ -28,11 +28,12 @@ namespace phronCare.API.Controllers.Sales
|
||||
}
|
||||
}
|
||||
[HttpGet("search")]
|
||||
public async Task<IActionResult> Search([FromQuery] string? name, [FromQuery] string? email, [FromQuery] string? document)
|
||||
public async Task<IActionResult> Search([FromQuery] string? name, [FromQuery] string? document, [FromQuery] string? email)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = await _customerService.SearchAsync(name, email, document);
|
||||
var result = await _customerService.SearchAsync(name, document,);
|
||||
var result = await _customerService.SearchAsync(name, document,);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user