From b8e7ec5c7925b0f62e9dc6efba28f1271f912801 Mon Sep 17 00:00:00 2001 From: Danail Dimitrov Date: Thu, 28 Jan 2021 22:40:15 +0200 Subject: Fixed the return type of UserService.DeleteUser and refactored UserController.Delete to return BadRequestObjectResult if user is not deleted successfully --- src/DevHive.Web/Controllers/UserController.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/DevHive.Web/Controllers') diff --git a/src/DevHive.Web/Controllers/UserController.cs b/src/DevHive.Web/Controllers/UserController.cs index e409eea..f9fb083 100644 --- a/src/DevHive.Web/Controllers/UserController.cs +++ b/src/DevHive.Web/Controllers/UserController.cs @@ -100,7 +100,10 @@ namespace DevHive.Web.Controllers if (!await this._userService.ValidJWT(id, authorization)) return new UnauthorizedResult(); - await this._userService.DeleteUser(id); + bool result = await this._userService.DeleteUser(id); + if (!result) + return new BadRequestObjectResult("Could not delete User"); + return new OkResult(); } #endregion -- cgit v1.2.3