Felhasználó és szabály törlésének befejezése

This commit is contained in:
2025-04-10 13:37:39 +02:00
parent 7109da0d95
commit cd57fc46bc
16 changed files with 1218 additions and 39 deletions
@@ -8,10 +8,12 @@ namespace WorkFlowCheck.Web.Services.Interfaces
Task<List<UserDTO>> GetAllUsers();
Task<ApiResponseDTO<UserDTO>> UpdateUser(UserDTO userDTO);
Task<ApiResponseDTO<UserDTO>> Authenticate(string username, string password);
Task<bool> DeleteUser(int id);
Task<RoleDTO> GetRole(int id);
Task<List<RoleDTO>> GetAllRoles();
Task<ApiResponseDTO<RoleDTO>> UpdateRole(RoleDTO roleDTO);
Task<bool> DeleteRole(int id);
Task<UserRoleDTO> GetUserRole(int id);
Task<List<UserRoleDTO>> GetAllUserRoles();
+42 -2
View File
@@ -120,7 +120,27 @@ namespace WorkFlowCheck.Web.Services
};
}
}
public async Task<bool> DeleteUser(int id)
{
string endpoint = $"{_httpClient.BaseAddress}api/User/DeleteUser/{id}";
var retVal = false;
try
{
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<bool>>(endpoint);
if (response != null)
{
if (response.IsSuccess)
{
return response.Data;
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<RoleDTO> GetRole(int id)
{
@@ -192,7 +212,27 @@ namespace WorkFlowCheck.Web.Services
};
}
}
public async Task<bool> DeleteRole(int id)
{
string endpoint = $"{_httpClient.BaseAddress}api/User/DeleteRole/{id}";
var retVal = false;
try
{
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<bool>>(endpoint);
if (response != null)
{
if (response.IsSuccess)
{
return response.Data;
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<UserRoleDTO> GetUserRole(int id)
{