src/main/java/com/danielezihe/controllers/UserController.java
/**
     * Adds a user to the users OrderedMap.
     * @param name Username to be saved
     * @param email User email to be saved
     * @param password User password to be saved
     * @return the {@link UserEntity} that was saved
     * @throws UnsupportedOperationException if a User tries to create an account with an Email that already exists
     */
Adds a user to the users OrderedMap.
Adds a user to the users OrderedMap .
public UserEntity save(String name, String email, String password) {
        String hashedPassword = hashPassword(password);
        int id = users.size() + 1;
        ToDoController toDoController = new ToDoController(new TreeBidiMap<>());
        UserEntity newUser = new UserEntity(id, name, email, hashedPassword, toDoController);
        if(users.get(email) == null)
            users.put(email, newUser);
        else
            throw new UnsupportedOperationException("User with email: " + email + " already exists");
        return newUser;
    }
public UserEntity save ( String name , String email , String password ) { String hashedPassword = hashPassword ( password ) ; int id = users . size ( ) + 1 ; ToDoController toDoController = new ToDoController ( new TreeBidiMap < > ( ) ) ; UserEntity newUser = new UserEntity ( id , name , email , hashedPassword , toDoController ) ; if ( users . get ( email ) == null ) users . put ( email , newUser ) ; else throw new UnsupportedOperationException ( "User with email: " + email + " already exists" ) ; return newUser ; }
Adds a user to the users OrderedMap.
Adds a user to the users OrderedMap .