public ContentValues generateContentValuesUser(User user) { ContentValues contentValues = new ContentValues(); contentValues.put(USERNAME_COLUMN, user.getUsername()); contentValues.put(PASSWORD_COLUMN, user.getPassword()); contentValues.put(NAME_COLUMN, user.getName()); contentValues.put(CREDITS_COLUMN, user.getCredits()); return contentValues; }
public void editUserInformations(User user) { ContentValues values = generateContentValuesUser(user); database.update(TABLE_NAME, values, USERNAME_COLUMN + " = " + user.getUsername(), null); }
public void deleteUser(User user) { String[] valuesToReplace = {String.valueOf(user.getUsername())}; database.delete(TABLE_NAME, USERNAME_COLUMN + " = ?", valuesToReplace); }