Commit 85aa7fe5b3ca8accea3d1a140cf57bda33cd92cc
1 parent
d5edb70f
refactor: Kleinigkeit im Service und Controller
Showing
2 changed files
with
5 additions
and
3 deletions
src/main/java/net/ziemers/swxercise/lg/user/service/UserService.java
... | ... | @@ -142,7 +142,7 @@ public class UserService { |
142 | 142 | public boolean deleteUser() { |
143 | 143 | // ist zurzeit ein Benutzer angemeldet, können wir ihn löschen |
144 | 144 | final User user = sessionContext.getUser(); |
145 | - return user != null && dao.remove(User.class, user.getId()) != null; | |
145 | + return user != null && deleteUser(user.getId()) != null; | |
146 | 146 | } |
147 | 147 | |
148 | 148 | /** | ... | ... |
src/main/java/net/ziemers/swxercise/ui/UserViewController.java
... | ... | @@ -157,8 +157,10 @@ public class UserViewController { |
157 | 157 | @Produces(MediaType.APPLICATION_JSON) |
158 | 158 | @RolesAllowed(RightState.Constants.ADMIN) |
159 | 159 | public RestResponse deleteUser(@PathParam("id") Long id) { |
160 | - userService.deleteUser(id); | |
161 | - return new RestResponse(); | |
160 | + if (userService.deleteUser(id) != null) { | |
161 | + return new RestResponse(); | |
162 | + } | |
163 | + return new RestResponse(ResponseState.FAILED); | |
162 | 164 | } |
163 | 165 | |
164 | 166 | /** | ... | ... |