public Restaurant updateRestaurant(long idresto, Restaurant restaurant) { ContentValues values = new ContentValues(); values.put(MySQLiteHelperResto.COLUMN_NOM, restaurant.getNom()); values.put(MySQLiteHelperResto.COLUMN_longitude, restaurant.getLongitude()); values.put(MySQLiteHelperResto.COLUMN_latitude, restaurant.getLatitude()); values.put(MySQLiteHelperResto.COLUMN_description, restaurant.getDescription()); values.put(MySQLiteHelperResto.COLUMN_email, restaurant.getEmail()); values.put(MySQLiteHelperResto.COLUMNhorairehouverture, restaurant.getHorairehouverture()); values.put(MySQLiteHelperResto.COLUMN_horairefermeture, restaurant.getHorairefermeture()); values.put(MySQLiteHelperResto.COLUMN_siteweb, restaurant.getSiteweb()); values.put(MySQLiteHelperResto.COLUMN_image, restaurant.getImage()); values.put(MySQLiteHelperResto.COLUMN_telephone, restaurant.getTelephone()); values.put(MySQLiteHelperResto.COLUMN_ville, restaurant.getVille()); values.put(MySQLiteHelperResto.COLUMN_pays, restaurant.getPays()); database.update( MySQLiteHelperResto.TABLE_Restaurant, values, MySQLiteHelperResto.COLUMN_ID + " = " + restaurant.getIdresto(), null); return getRestaurantWithId(restaurant.getIdresto()); }
public void deleteRestaurant(Restaurant restaurant) { long id = restaurant.getIdresto(); System.out.println("Restaurant deleted with id: " + id); database.delete( MySQLiteHelperResto.TABLE_Restaurant, MySQLiteHelperResto.COLUMN_ID + " = " + id, null); }