Featching the industry while create tenant enquire

This commit is contained in:
ashutosh.nehete 2025-10-28 15:39:34 +05:30
parent 5253ed9a39
commit 86b37549eb

View File

@ -932,6 +932,14 @@ namespace Marco.Pms.Services.Controllers
return StatusCode(409, ApiResponse<object>.ErrorResponse("Tenant cannot be created", "A user with the specified email already exists.", 409));
}
var industry = await context.Industries.FirstOrDefaultAsync(i => i.Id == model.IndustryId);
if (industry == null)
{
_logger.LogWarning("Industry not found while creating the tenant enquire");
return NotFound(ApiResponse<object>.ErrorResponse("Industry not found", "Industry not found", 404));
}
// Map DTO to domain model and assign new Guid
var tenantEnquire = _mapper.Map<TenantEnquire>(model);
tenantEnquire.Id = Guid.NewGuid();