use of easytests.core.models.UserModelInterface in project easy-tests by malinink.
the class UsersService method map.
private UserModelInterface map(UserEntity userEntity) {
if (userEntity == null) {
return null;
}
final UserModelInterface userModel = new UserModel();
userModel.map(userEntity);
return userModel;
}
use of easytests.core.models.UserModelInterface in project easy-tests by malinink.
the class UsersController method save.
@PostMapping("update/{userId}/")
public String save(Model model, @PathVariable Integer userId, @Valid UserModelDto userModelDto, BindingResult bindingResult) {
final UserModelInterface userModel = this.getUserModel(userId);
userModelDto.setId(userId);
this.userModelDtoValidator.validate(userModelDto, bindingResult);
if (bindingResult.hasErrors()) {
model.addAttribute("user", userModelDto);
model.addAttribute("errors", bindingResult);
setUpdateBehaviour(model);
return "admin/users/form";
}
userModelDto.mapInto(userModel);
this.usersService.save(userModel);
return "redirect:/admin/users/";
}
use of easytests.core.models.UserModelInterface in project easy-tests by malinink.
the class UsersController method view.
@GetMapping("{userId}/")
public String view(Model model, @PathVariable Integer userId) {
final UserModelInterface userModel = this.getUserModel(userId);
model.addAttribute("user", userModel);
return "admin/users/view";
}
use of easytests.core.models.UserModelInterface in project easy-tests by malinink.
the class UsersController method insert.
@PostMapping("create/")
public String insert(Model model, @Valid UserModelDto userModelDto, BindingResult bindingResult) {
this.userModelDtoValidator.validate(userModelDto, bindingResult);
if (bindingResult.hasErrors()) {
model.addAttribute("user", userModelDto);
model.addAttribute("errors", bindingResult);
setCreateBehaviour(model);
return "admin/users/form";
}
final UserModelInterface userModel = new UserModel();
userModelDto.mapInto(userModel);
this.usersService.save(userModel);
return "redirect:/admin/users/";
}
use of easytests.core.models.UserModelInterface in project easy-tests by malinink.
the class UsersController method update.
@GetMapping("update/{userId}/")
public String update(Model model, @PathVariable Integer userId) {
final UserModelInterface userModel = this.getUserModel(userId);
final UserModelDto userModelDto = new UserModelDto();
userModelDto.map(userModel);
model.addAttribute("user", userModelDto);
setUpdateBehaviour(model);
return "admin/users/form";
}
Aggregations