From d240a79e49150f7b895b35bc7fdaa0a2253fbdd4 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 16 Aug 2025 17:15:01 +0530 Subject: [PATCH] Assigning the root employee to default when creating the tenant --- Marco.Pms.Services/Controllers/TenantController.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/TenantController.cs b/Marco.Pms.Services/Controllers/TenantController.cs index fe6e521..d05f0c3 100644 --- a/Marco.Pms.Services/Controllers/TenantController.cs +++ b/Marco.Pms.Services/Controllers/TenantController.cs @@ -352,7 +352,6 @@ namespace Marco.Pms.Services.Controllers return Ok(ApiResponse.SuccessResponse(response, "Tenant profile fetched successfully", 200)); } - // POST api/ [HttpPost("create")] public async Task CreateTenant([FromBody] CreateTenantDto model) @@ -551,6 +550,17 @@ namespace Marco.Pms.Services.Controllers }; _context.Projects.Add(project); + var projectAllocation = new ProjectAllocation + { + ProjectId = project.Id, + EmployeeId = employeeUser.Id, + AllocationDate = model.OnBoardingDate, + IsActive = true, + JobRoleId = adminJobRole.Id, + TenantId = tenant.Id + }; + _context.ProjectAllocations.Add(projectAllocation); + // All entities are now added to the context. Save them all in a single database operation. await _context.SaveChangesAsync();