Search in sources :

Example 1 with EditUserRequest

use of com.zavada.domain.EditUserRequest in project Logos_Materials_October_2017 by VolodymyrZavada.

the class UserController method editUserProfile.

@GetMapping("/edit/{userId}")
public String editUserProfile(@PathVariable("userId") int userId, Model model, Principal principal) {
    UserEntity entity = userService.findUserByEmail(principal.getName());
    if (userId != entity.getId())
        return "redirect:/user";
    EditUserRequest request = UserMapper.entityToEditUser(entity);
    model.addAttribute("editModel", request);
    return "user/edit";
}
Also used : EditUserRequest(com.zavada.domain.EditUserRequest) UserEntity(com.zavada.entity.UserEntity) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 2 with EditUserRequest

use of com.zavada.domain.EditUserRequest in project Logos_Materials_October_2017 by VolodymyrZavada.

the class UserMapper method entityToEditUser.

// Edit user
public static EditUserRequest entityToEditUser(UserEntity entity) {
    EditUserRequest request = new EditUserRequest();
    request.setId(entity.getId());
    request.setEmail(entity.getEmail());
    request.setFirstName(entity.getFirstName());
    request.setLastName(entity.getLastName());
    request.setAge(entity.getAge());
    request.setPhoneNumber(entity.getPhoneNumber());
    // <----
    request.setPassword(entity.getPassword());
    return request;
}
Also used : EditUserRequest(com.zavada.domain.EditUserRequest)

Aggregations

EditUserRequest (com.zavada.domain.EditUserRequest)2 UserEntity (com.zavada.entity.UserEntity)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1