Controller mit Fehlerbehandlung zu UserRepController hinzugefügt.
This commit is contained in:
parent
5b8b10f162
commit
f83b92ab63
@ -9,7 +9,7 @@ using Microsoft.Data.SqlClient;
|
||||
namespace DigitalData.UserManager.API.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
public class UserRepController : CRUDControllerBase<IUserRepService, UserRepCreateDto, UserRepReadDto, UserRepUpdateDto, UserRep, int>
|
||||
public class UserRepController : CRUDControllerBaseWithErrorHandling<IUserRepService, UserRepCreateDto, UserRepReadDto, UserRepUpdateDto, UserRep, int>
|
||||
{
|
||||
public UserRepController(ILogger<UserRepController> logger, IUserRepService service) : base(logger, service)
|
||||
{
|
||||
@ -41,21 +41,5 @@ namespace DigitalData.UserManager.API.Controllers
|
||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||
}
|
||||
}
|
||||
|
||||
public override async Task<IActionResult> Create(UserRepCreateDto createDto)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await base.Create(createDto);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var innerEx = ex.InnerException;
|
||||
if (innerEx is SqlException)
|
||||
return BadRequest(innerEx.Message);
|
||||
else
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user