lab2 fixed services
This commit is contained in:
parent
f25171e835
commit
5b19352e87
@ -48,6 +48,7 @@ public class BookService {
|
||||
|
||||
public BookEntity update(Long id, BookEntity entity) {
|
||||
final BookEntity existsEntity = get(id);
|
||||
existsEntity.setName(entity.getName());
|
||||
existsEntity.setType(entity.getType());
|
||||
existsEntity.setAuthor(entity.getAuthor());
|
||||
return repository.update(existsEntity);
|
||||
|
@ -27,12 +27,16 @@ public class UserService {
|
||||
}
|
||||
|
||||
public UserEntity create(UserEntity entity) {
|
||||
if (entity.getRole().equals("admin")) {
|
||||
entity.setRole("user");
|
||||
}
|
||||
return repository.create(entity);
|
||||
}
|
||||
|
||||
public UserEntity update(Long id, UserEntity entity) {
|
||||
final UserEntity existsEntity = get(id);
|
||||
existsEntity.setName(entity.getName());
|
||||
existsEntity.setPassword(entity.getPassword());
|
||||
return repository.update(existsEntity);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user