Try-Catch zum GroupOfUserController hinzugefügt
This commit is contained in:
parent
66d6fa1f71
commit
cef098f265
@ -17,6 +17,8 @@ namespace DigitalData.UserManager.API.Controllers
|
||||
|
||||
[HttpDelete]
|
||||
public async Task<IActionResult> Delete([FromQuery] int groupId, [FromQuery] int userId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = await _service.DeleteAsyncByGroupUserId(groupId, userId);
|
||||
if (result.IsSuccess)
|
||||
@ -26,12 +28,20 @@ namespace DigitalData.UserManager.API.Controllers
|
||||
|
||||
return BadRequest(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "{Message}", ex.Message);
|
||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||
}
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public override Task<IActionResult> GetAll() => base.GetAll();
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetAll([FromQuery]bool withUser = false, [FromQuery]bool withGroup = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = await _service.ReadAllAsyncWith(withUser, withGroup);
|
||||
if (result.IsSuccess)
|
||||
@ -41,11 +51,25 @@ namespace DigitalData.UserManager.API.Controllers
|
||||
|
||||
return NotFound(result);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "{Message}", ex.Message);
|
||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("Has")]
|
||||
public async Task<IActionResult> HasGroup([FromQuery] string username, [FromQuery] string groupname)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(await _service.HasGroup(username, groupname));
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "{Message}", ex.Message);
|
||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user