/** * Post request to update user. Update email, first, last, password and handId. Does not update * birthday or gender. Gender does not exist as a field in the DB and for sake of time Birthday * was not completed. * * @param userId * @param request * @param response * @return */ @RequestMapping(value = "/adminsitration/users/update-user", method = RequestMethod.POST) public ModelAndView UpdateUser( @ModelAttribute("viewModel") AdministrationUserEditViewModel viewModel, Model model, RedirectAttributes redirectAttributes) { ModelAndView result = new ModelAndView("redirect:/administration/users"); int userID = viewModel.getUserId(); if (viewModel.getEmail() != null) _accountService.updateUserEmail(userID, viewModel.getEmail()); if (viewModel.getFirstName() != null) _accountService.updateUserHandleFirstName(userID, viewModel.getFirstName()); if (viewModel.getLastName() != null) _accountService.updateUserHandleLastName(userID, viewModel.getLastName()); if (viewModel.getPassword() != null) _accountService.updateUserPassword(userID, viewModel.getPassword()); if (viewModel.getHandedness() != null) _accountService.updateUserHandId(userID, viewModel.getHandedness()); model.addAttribute("model", viewModel); return result; }