From 86b37549eb3aba8859991219436d1124c22cefa3 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 28 Oct 2025 15:39:34 +0530 Subject: [PATCH] Featching the industry while create tenant enquire --- Marco.Pms.Services/Controllers/TenantController.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Marco.Pms.Services/Controllers/TenantController.cs b/Marco.Pms.Services/Controllers/TenantController.cs index b6b4ff4..e09fe35 100644 --- a/Marco.Pms.Services/Controllers/TenantController.cs +++ b/Marco.Pms.Services/Controllers/TenantController.cs @@ -932,6 +932,14 @@ namespace Marco.Pms.Services.Controllers return StatusCode(409, ApiResponse.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.ErrorResponse("Industry not found", "Industry not found", 404)); + } + // Map DTO to domain model and assign new Guid var tenantEnquire = _mapper.Map(model); tenantEnquire.Id = Guid.NewGuid();