Check if email exist in total tenant
This commit is contained in:
parent
87c5de87a1
commit
0e1d20156f
@ -612,10 +612,10 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
if (!string.IsNullOrWhiteSpace(model.Email))
|
if (!string.IsNullOrWhiteSpace(model.Email))
|
||||||
{
|
{
|
||||||
var emailExists = await _context.Employees
|
var emailExists = await _context.Employees
|
||||||
.AnyAsync(e => e.Email == model.Email && e.OrganizationId == organizationId);
|
.AnyAsync(e => e.Email == model.Email);
|
||||||
if (emailExists)
|
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(
|
return StatusCode(403, ApiResponse<object>.ErrorResponse(
|
||||||
"Employee with email already exists",
|
"Employee with email already exists",
|
||||||
"Employee with this email already exists", 403));
|
"Employee with this email already exists", 403));
|
||||||
@ -845,7 +845,7 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
if (model.Id == null || model.Id == Guid.Empty)
|
if (model.Id == null || model.Id == Guid.Empty)
|
||||||
{
|
{
|
||||||
var emailExists = await _context.Employees
|
var emailExists = await _context.Employees
|
||||||
.AnyAsync(e => e.Email == model.Email && e.OrganizationId == organizationId);
|
.AnyAsync(e => e.Email == model.Email);
|
||||||
|
|
||||||
if (emailExists)
|
if (emailExists)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user