UserService Delete metódusai + controller
This commit is contained in:
@@ -17,7 +17,7 @@ namespace WorkFlowCheck.API.Controllers
|
||||
{
|
||||
_userService = userService;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("GetUser/{id}")]
|
||||
public async Task<ApiResponseDTO<UserDTO>> GetUser(int id)
|
||||
{
|
||||
@@ -82,8 +82,8 @@ namespace WorkFlowCheck.API.Controllers
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
retVal.IsSuccess = true;
|
||||
retVal.Data = result;
|
||||
retVal.IsSuccess = true;
|
||||
retVal.Data = result;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -263,6 +263,28 @@ namespace WorkFlowCheck.API.Controllers
|
||||
|
||||
return retVal;
|
||||
}
|
||||
[HttpGet("DeleteRole/{id}")]
|
||||
public async Task<ApiResponseDTO<bool>> DeleteRole(int id)
|
||||
{
|
||||
var retVal = new ApiResponseDTO<bool>()
|
||||
{
|
||||
IsSuccess = true,
|
||||
};
|
||||
var result = await _userService.DeleteRoleAsync(id);
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
retVal.IsSuccess = true;
|
||||
retVal.Data = result;
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal.IsSuccess = false;
|
||||
retVal.Errors.Add("No data!");
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
[HttpPost("UpdateRole")]
|
||||
public async Task<ApiResponseDTO<RoleDTO>> UpdateRole([FromBody] RoleDTO roleDTO)
|
||||
{
|
||||
@@ -339,14 +361,14 @@ namespace WorkFlowCheck.API.Controllers
|
||||
|
||||
return retVal;
|
||||
}
|
||||
[HttpGet("DeleteRole/{id}")]
|
||||
public async Task<ApiResponseDTO<bool>> DeleteRole(int id)
|
||||
[HttpGet("DeleteUserRole/{id}")]
|
||||
public async Task<ApiResponseDTO<bool>> DeleteUserRole(int id)
|
||||
{
|
||||
var retVal = new ApiResponseDTO<bool>()
|
||||
{
|
||||
IsSuccess = true,
|
||||
};
|
||||
var result = await _userService.DeleteRoleAsync(id);
|
||||
var result = await _userService.DeleteUserRoleAsync(id);
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
@@ -437,6 +459,28 @@ namespace WorkFlowCheck.API.Controllers
|
||||
|
||||
return retVal;
|
||||
}
|
||||
[HttpGet("DeleteRoleCheckListTemplateHeader/{id}")]
|
||||
public async Task<ApiResponseDTO<bool>> DeleteRoleCheckListTemplateHeader(int id)
|
||||
{
|
||||
var retVal = new ApiResponseDTO<bool>()
|
||||
{
|
||||
IsSuccess = true,
|
||||
};
|
||||
var result = await _userService.DeleteRoleCheckListTemplateHeaderAsync(id);
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
retVal.IsSuccess = true;
|
||||
retVal.Data = result;
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal.IsSuccess = false;
|
||||
retVal.Errors.Add("No data!");
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
[HttpPost("UpdateRoleCheckListTemplateHeader")]
|
||||
public async Task<ApiResponseDTO<RoleCheckListTemplateHeaderDTO>> UpdateRoleCheckListTemplateHeader([FromBody] RoleCheckListTemplateHeaderDTO roleCheckListTemplateHeaderDTO)
|
||||
{
|
||||
@@ -512,6 +556,28 @@ namespace WorkFlowCheck.API.Controllers
|
||||
|
||||
return retVal;
|
||||
}
|
||||
[HttpGet("DeleteRoleCheckPoint/{id}")]
|
||||
public async Task<ApiResponseDTO<bool>> DeleteRoleCheckPoint(int id)
|
||||
{
|
||||
var retVal = new ApiResponseDTO<bool>()
|
||||
{
|
||||
IsSuccess = true,
|
||||
};
|
||||
var result = await _userService.DeleteRoleCheckPointAsync(id);
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
retVal.IsSuccess = true;
|
||||
retVal.Data = result;
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal.IsSuccess = false;
|
||||
retVal.Errors.Add("No data!");
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
[HttpPost("UpdateRoleCheckPoint")]
|
||||
public async Task<ApiResponseDTO<RoleCheckPointDTO>> UpdateRoleCheckPoint([FromBody] RoleCheckPointDTO roleCheckPointDTO)
|
||||
{
|
||||
|
||||
@@ -24,14 +24,17 @@ namespace WorkFlowCheck.BL.Services.Interfaces
|
||||
|
||||
Task<UserRoleDTO> GetUserRoleAsync(int Id);
|
||||
Task<List<UserRoleDTO>> GetAllUserRoleAsync();
|
||||
Task<bool> DeleteUserRoleAsync(int Id);
|
||||
Task<UserRoleDTO> UpdateUserRoleAsync(UserRoleDTO userRoleDTO);
|
||||
|
||||
Task<RoleCheckListTemplateHeaderDTO> GetRoleCheckListTemplateHeaderAsync(int Id);
|
||||
Task<List<RoleCheckListTemplateHeaderDTO>> GetAllRoleCheckListTemplateHeadersAsync();
|
||||
Task<bool> DeleteRoleCheckListTemplateHeaderAsync(int Id);
|
||||
Task<RoleCheckListTemplateHeaderDTO> UpdateRoleCheckListTemplateHeaderAsync(RoleCheckListTemplateHeaderDTO roleCheckListTemplateHeaderDTO);
|
||||
|
||||
Task<RoleCheckPointDTO> GetRoleCheckPointAsync(int Id);
|
||||
Task<List<RoleCheckPointDTO>> GetAllRoleCheckPointsAsync();
|
||||
Task<bool> DeleteRoleCheckPointAsync(int Id);
|
||||
Task<RoleCheckPointDTO> UpdateRoleCheckPointAsync(RoleCheckPointDTO roleCheckPointDTO);
|
||||
|
||||
string GenerateJwtToken(UserDTO userDTO);
|
||||
|
||||
@@ -372,6 +372,10 @@ namespace WorkFlowCheck.BL.Services
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
public async Task<bool> DeleteUserRoleAsync(int id)
|
||||
{
|
||||
return await DeleteEntityByIdAsync<UserRole>(id);
|
||||
}
|
||||
public async Task<UserRoleDTO> UpdateUserRoleAsync(UserRoleDTO userRoleDTO)
|
||||
{
|
||||
var retVal = new UserRoleDTO();
|
||||
@@ -449,6 +453,10 @@ namespace WorkFlowCheck.BL.Services
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
public async Task<bool> DeleteRoleCheckListTemplateHeaderAsync(int id)
|
||||
{
|
||||
return await DeleteEntityByIdAsync<RoleCheckListTemplateHeader>(id);
|
||||
}
|
||||
public async Task<RoleCheckListTemplateHeaderDTO> UpdateRoleCheckListTemplateHeaderAsync(RoleCheckListTemplateHeaderDTO roleCheckListTemplateHeaderDTO)
|
||||
{
|
||||
var retVal = new RoleCheckListTemplateHeaderDTO();
|
||||
@@ -539,6 +547,10 @@ namespace WorkFlowCheck.BL.Services
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
public async Task<bool> DeleteRoleCheckPointAsync(int id)
|
||||
{
|
||||
return await DeleteEntityByIdAsync<RoleCheckPoint>(id);
|
||||
}
|
||||
public async Task<RoleCheckPointDTO> UpdateRoleCheckPointAsync(RoleCheckPointDTO roleCheckPointDTO)
|
||||
{
|
||||
var retVal = new RoleCheckPointDTO();
|
||||
|
||||
Reference in New Issue
Block a user