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.Accounttypes)
|
||||||
.Include(c => c.PhSCustomerDocuments)
|
.Include(c => c.PhSCustomerDocuments)
|
||||||
.Include(c => c.PhSCustomerAddresses)
|
.Include(c => c.PhSCustomerAddresses)
|
||||||
.Take(3)
|
.Take(100)
|
||||||
.AsQueryable();
|
.AsQueryable();
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(name))
|
if (!string.IsNullOrWhiteSpace(name))
|
||||||
@ -53,12 +53,6 @@ namespace Models.Repositories
|
|||||||
c.BusinessName.ToLower().Contains(loweredName));
|
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))
|
if (!string.IsNullOrWhiteSpace(email))
|
||||||
{
|
{
|
||||||
var loweredEmail = email.ToLower();
|
var loweredEmail = email.ToLower();
|
||||||
@ -67,6 +61,13 @@ namespace Models.Repositories
|
|||||||
a.Email.ToLower().Contains(loweredEmail)));
|
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();
|
var customers = await query.ToListAsync();
|
||||||
|
|
||||||
Console.WriteLine($"VALOR RECIBIDO DE 'name': {name}");
|
Console.WriteLine($"VALOR RECIBIDO DE 'name': {name}");
|
||||||
|
|||||||
@ -28,11 +28,12 @@ namespace phronCare.API.Controllers.Sales
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
[HttpGet("search")]
|
[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
|
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);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user