Search in sources :

Example 6 with Maillot

use of ch.hsr.sa.radiotour.dataaccess.models.Maillot in project app by TourLive.

the class MaillotRepository method addRiderToMaillot.

@Override
public void addRiderToMaillot(Maillot maillot, int riderDbId) {
    Realm realm = Realm.getInstance(RadioTourApplication.getInstance());
    Maillot realmMaillot = realm.where(Maillot.class).equalTo("id", maillot.getId()).findFirst();
    Rider rider = realm.where(Rider.class).equalTo("riderID", riderDbId).findFirst();
    realm.beginTransaction();
    realmMaillot.setRider(rider);
    realm.commitTransaction();
}
Also used : Maillot(ch.hsr.sa.radiotour.dataaccess.models.Maillot) Realm(io.realm.Realm) Rider(ch.hsr.sa.radiotour.dataaccess.models.Rider)

Aggregations

Maillot (ch.hsr.sa.radiotour.dataaccess.models.Maillot)6 Realm (io.realm.Realm)4 RealmList (io.realm.RealmList)2 JSONArray (org.json.JSONArray)2 JSONException (org.json.JSONException)2 JSONObject (org.json.JSONObject)2 Rider (ch.hsr.sa.radiotour.dataaccess.models.Rider)1