Compare commits
3 Commits
cdd67c1137
...
c701187223
Author | SHA1 | Date | |
---|---|---|---|
c701187223 | |||
bed58af120 | |||
![]() |
7a1a4d6bdb |
@ -175,6 +175,13 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
{
|
{
|
||||||
return BadRequest(new { Message = "Feature Permission is required." });
|
return BadRequest(new { Message = "Feature Permission is required." });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool roleExists = _context.ApplicationRoles
|
||||||
|
.Any(r => r.TenantId == TenantId && r.Role.ToLower() == createRoleDto.Role.ToLower());// assuming role name is unique per tenant
|
||||||
|
if (roleExists)
|
||||||
|
{
|
||||||
|
return BadRequest(new {message = "Role already exists." });
|
||||||
|
}
|
||||||
ApplicationRole role = createRoleDto.ToApplicationRoleFromCreateDto(TenantId);
|
ApplicationRole role = createRoleDto.ToApplicationRoleFromCreateDto(TenantId);
|
||||||
_context.ApplicationRoles.Add(role);
|
_context.ApplicationRoles.Add(role);
|
||||||
|
|
||||||
@ -202,6 +209,7 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
if (id != updateRoleDto.Id.ToString())
|
if (id != updateRoleDto.Id.ToString())
|
||||||
return BadRequest("Role ID mismatch");
|
return BadRequest("Role ID mismatch");
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int TenantId = GetTenantId();
|
int TenantId = GetTenantId();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user