Check if email exist in total tenant

This commit is contained in:
ashutosh.nehete 2025-10-01 17:16:27 +05:30
parent 87c5de87a1
commit 0e1d20156f

View File

@ -612,10 +612,10 @@ namespace MarcoBMS.Services.Controllers
if (!string.IsNullOrWhiteSpace(model.Email))
{
var emailExists = await _context.Employees
.AnyAsync(e => e.Email == model.Email && e.OrganizationId == organizationId);
.AnyAsync(e => e.Email == model.Email);
if (emailExists)
{
_logger.LogInfo("Employee email already exists in org. Email={Email}, Org={OrgId}", model.Email, organizationId);
_logger.LogInfo("Employee email already exists. Email={Email}", model.Email);
return StatusCode(403, ApiResponse<object>.ErrorResponse(
"Employee with email already exists",
"Employee with this email already exists", 403));
@ -845,7 +845,7 @@ namespace MarcoBMS.Services.Controllers
if (model.Id == null || model.Id == Guid.Empty)
{
var emailExists = await _context.Employees
.AnyAsync(e => e.Email == model.Email && e.OrganizationId == organizationId);
.AnyAsync(e => e.Email == model.Email);
if (emailExists)
{