Try-Catch zu UserRepController hinzugefügt
This commit is contained in:
parent
3a0edfe956
commit
d16097d1b1
@ -2,7 +2,6 @@
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.UserRep;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Data.SqlClient;
|
||||
@ -25,14 +24,22 @@ namespace DigitalData.UserManager.API.Controllers
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetAll(bool withUser = false, bool withRepGroup = false, bool withRightGroup = false, bool withRepUser = false, int? userId = null)
|
||||
{
|
||||
var result = await _service.ReadAllAsync(withUser, withRepGroup, withRightGroup, withRepUser, userId);
|
||||
|
||||
if (result.IsSuccess)
|
||||
try
|
||||
{
|
||||
return Ok(result);
|
||||
}
|
||||
var result = await _service.ReadAllAsync(withUser, withRepGroup, withRightGroup, withRepUser, userId);
|
||||
|
||||
return NotFound(result);
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
return NotFound(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "{Message}", ex.Message);
|
||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||
}
|
||||
}
|
||||
|
||||
public override async Task<IActionResult> Create(UserRepCreateDto createDto)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user