diff options
| author | Danail Dimitrov <danaildimitrov321@gmail.com> | 2021-01-28 22:40:15 +0200 |
|---|---|---|
| committer | Danail Dimitrov <danaildimitrov321@gmail.com> | 2021-01-28 22:40:15 +0200 |
| commit | b8e7ec5c7925b0f62e9dc6efba28f1271f912801 (patch) | |
| tree | 50e94cb31f3671cd8f1aee641498a6022ee7f7ce /src/DevHive.Web/Controllers | |
| parent | 9ceef59cb170640cb7cff643de7efd19ad8a48e9 (diff) | |
| download | DevHive-b8e7ec5c7925b0f62e9dc6efba28f1271f912801.tar DevHive-b8e7ec5c7925b0f62e9dc6efba28f1271f912801.tar.gz DevHive-b8e7ec5c7925b0f62e9dc6efba28f1271f912801.zip | |
Fixed the return type of UserService.DeleteUser and refactored UserController.Delete to return BadRequestObjectResult if user is not deleted successfully
Diffstat (limited to 'src/DevHive.Web/Controllers')
| -rw-r--r-- | src/DevHive.Web/Controllers/UserController.cs | 5 |
1 files changed, 4 insertions, 1 deletions
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 |
