Sprint 8 #43
@@ -43,12 +43,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
var message = this._somethingWentWrong;
|
||||
if (!String.IsNullOrEmpty(exception.Message))
|
||||
{
|
||||
message += $". {exception.Message}";
|
||||
}
|
||||
return InternalServerError(message);
|
||||
return InternalServerError(exception);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -66,9 +66,13 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
||||
return StatusCode((int)HttpStatusCode.BadRequest, CreateResponse(HttpStatusCode.BadRequest, message, data));
|
||||
}
|
||||
|
||||
protected IActionResult InternalServerError(string message)
|
||||
protected IActionResult InternalServerError(Exception exception)
|
||||
{
|
||||
message = String.IsNullOrEmpty(message) ? "Internal server error" : message;
|
||||
var message = this._somethingWentWrong;
|
||||
if (!String.IsNullOrEmpty(exception.Message))
|
||||
{
|
||||
message += $". {exception.Message}";
|
||||
}
|
||||
return StatusCode((int)HttpStatusCode.InternalServerError, CreateResponse(HttpStatusCode.InternalServerError, message, new object()));
|
||||
}
|
||||
|
||||
|
||||
@@ -47,12 +47,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
var message = this._somethingWentWrong;
|
||||
if (!String.IsNullOrEmpty(exception.Message))
|
||||
{
|
||||
message += $". {exception.Message}";
|
||||
}
|
||||
return InternalServerError(message);
|
||||
return InternalServerError(exception);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -88,12 +83,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
var message = this._somethingWentWrong;
|
||||
if (!String.IsNullOrEmpty(exception.Message))
|
||||
{
|
||||
message += $". {exception.Message}";
|
||||
}
|
||||
return InternalServerError(message);
|
||||
return InternalServerError(exception);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -101,7 +91,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
||||
[JwtAuthorization()]
|
||||
[ModelStateValidationHandledByFilterAttribute]
|
||||
[HttpPut("update/{guid}")]
|
||||
[ProducesResponseType<GetRoleResponse>(StatusCodes.Status201Created)]
|
||||
[ProducesResponseType<GetRoleResponse>(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType<BaseResponse<object>>(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType<BaseResponse<object>>(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<IActionResult> UpdateRoleAsync([FromBody] CreateRoleRequest request, string guid) //NOSONAR
|
||||
@@ -139,12 +129,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
var message = this._somethingWentWrong;
|
||||
if (!String.IsNullOrEmpty(exception.Message))
|
||||
{
|
||||
message += $". {exception.Message}";
|
||||
}
|
||||
return InternalServerError(message);
|
||||
return InternalServerError(exception);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -173,12 +158,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
var message = this._somethingWentWrong;
|
||||
if (!String.IsNullOrEmpty(exception.Message))
|
||||
{
|
||||
message += $". {exception.Message}";
|
||||
}
|
||||
return InternalServerError(message);
|
||||
return InternalServerError(exception);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -51,17 +51,12 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
var message = this._somethingWentWrong;
|
||||
if (!String.IsNullOrEmpty(exception.Message))
|
||||
{
|
||||
message += $". {exception.Message}";
|
||||
}
|
||||
return InternalServerError(message);
|
||||
return InternalServerError(exception);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// [JwtAuthorization()]
|
||||
[JwtAuthorization()]
|
||||
[ModelStateValidationHandledByFilterAttribute]
|
||||
[HttpPost("create")]
|
||||
[ProducesResponseType<GetUserResponse>(StatusCodes.Status201Created)]
|
||||
@@ -98,12 +93,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
var message = this._somethingWentWrong;
|
||||
if (!String.IsNullOrEmpty(exception.Message))
|
||||
{
|
||||
message += $". {exception.Message}";
|
||||
}
|
||||
return InternalServerError(message);
|
||||
return InternalServerError(exception);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -111,7 +101,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
||||
[JwtAuthorization()]
|
||||
[ModelStateValidationHandledByFilterAttribute]
|
||||
[HttpPut("update/{guid}")]
|
||||
[ProducesResponseType<GetUserResponse>(StatusCodes.Status201Created)]
|
||||
[ProducesResponseType<GetUserResponse>(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType<BaseResponse<object>>(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType<BaseResponse<object>>(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<IActionResult> UpdateUserAsync([FromBody] UpdateUserRequest request, string guid) //NOSONAR
|
||||
@@ -133,12 +123,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
var message = this._somethingWentWrong;
|
||||
if (!String.IsNullOrEmpty(exception.Message))
|
||||
{
|
||||
message += $". {exception.Message}";
|
||||
}
|
||||
return InternalServerError(message);
|
||||
return InternalServerError(exception);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -146,7 +131,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
||||
[JwtAuthorization()]
|
||||
[ModelStateValidationHandledByFilterAttribute]
|
||||
[HttpPut("update/{guid}/password")]
|
||||
[ProducesResponseType<GetUserResponse>(StatusCodes.Status201Created)]
|
||||
[ProducesResponseType<GetUserResponse>(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType<BaseResponse<object>>(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType<BaseResponse<object>>(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<IActionResult> UpdateUserPasswordAsync(string guid, string newPassword)
|
||||
@@ -168,12 +153,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
var message = this._somethingWentWrong;
|
||||
if (!String.IsNullOrEmpty(exception.Message))
|
||||
{
|
||||
message += $". {exception.Message}";
|
||||
}
|
||||
return InternalServerError(message);
|
||||
return InternalServerError(exception);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -181,7 +161,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
||||
[JwtAuthorization()]
|
||||
[ModelStateValidationHandledByFilterAttribute]
|
||||
[HttpPut("update/{guid}/role")]
|
||||
[ProducesResponseType<GetUserResponse>(StatusCodes.Status201Created)]
|
||||
[ProducesResponseType<GetUserResponse>(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType<BaseResponse<object>>(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType<BaseResponse<object>>(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<IActionResult> UpdateUserRoleAsync(string guid, string roleGuid)
|
||||
@@ -209,12 +189,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
var message = this._somethingWentWrong;
|
||||
if (!String.IsNullOrEmpty(exception.Message))
|
||||
{
|
||||
message += $". {exception.Message}";
|
||||
}
|
||||
return InternalServerError(message);
|
||||
return InternalServerError(exception);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -243,12 +218,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
var message = this._somethingWentWrong;
|
||||
if (!String.IsNullOrEmpty(exception.Message))
|
||||
{
|
||||
message += $". {exception.Message}";
|
||||
}
|
||||
return InternalServerError(message);
|
||||
return InternalServerError(exception);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,9 +11,6 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
||||
) : base(configuration) { }
|
||||
|
||||
[HttpGet("get")]
|
||||
public IActionResult GetVersion()
|
||||
{
|
||||
return Success(String.Empty, _appSettings?.Settings?.Version);
|
||||
}
|
||||
public IActionResult GetVersion() => Success(String.Empty, _appSettings?.Settings?.Version);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user