Assigning the root employee to default when creating the tenant
This commit is contained in:
parent
d8870b8140
commit
d240a79e49
@ -352,7 +352,6 @@ namespace Marco.Pms.Services.Controllers
|
|||||||
return Ok(ApiResponse<object>.SuccessResponse(response, "Tenant profile fetched successfully", 200));
|
return Ok(ApiResponse<object>.SuccessResponse(response, "Tenant profile fetched successfully", 200));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// POST api/<TenantController>
|
// POST api/<TenantController>
|
||||||
[HttpPost("create")]
|
[HttpPost("create")]
|
||||||
public async Task<IActionResult> CreateTenant([FromBody] CreateTenantDto model)
|
public async Task<IActionResult> CreateTenant([FromBody] CreateTenantDto model)
|
||||||
@ -551,6 +550,17 @@ namespace Marco.Pms.Services.Controllers
|
|||||||
};
|
};
|
||||||
_context.Projects.Add(project);
|
_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.
|
// All entities are now added to the context. Save them all in a single database operation.
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user