package Ġbr . com . fi ere ck . acade m ia . ui . work out . detail Ċ Ċ import Ġandroidx . lifecycle . Mutable LiveData Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġbr . com . fi ere ck . acade m ia . model . Exercise Model Ċ import Ġbr . com . fi ere ck . acade m ia . model . Work out Model Ċ import Ġbr . com . fi ere ck . acade m ia . repository . Exercise Repository Ċ import Ġbr . com . fi ere ck . acade m ia . repository . Work out Repository Ċ Ċ class ĠWork out Detail ViewModel Ġ: ĠViewModel () Ġ{ ĊĠĠĠ Ġprivate Ġval Ġwork out Repository : ĠWork out Repository Ġ= ĠWork out Repository () ĊĠĠĠ Ġprivate Ġval Ġexercise Repository : ĠExercise Repository Ġ= ĠExercise Repository () ĊĠĠĠ Ġvar Ġsuccess Get Exercise LiveData : ĠMutable LiveData < List < Exercise Model >> Ġ= ĠMutable LiveData () ĊĠĠĠ Ġval Ġerror Get Exercise LiveData : ĠMutable LiveData < String > Ġ= ĠMutable LiveData () ĊĠĠĠ Ġvar Ġsuccess Get Work out LiveData : ĠMutable LiveData < Work out Model > Ġ= ĠMutable LiveData () ĊĠĠĠ Ġval Ġerror Get Work out LiveData : ĠMutable LiveData < String > Ġ= ĠMutable LiveData () ĊĠĠĠ Ġval Ġsuccess Delete Work out LiveData : ĠMutable LiveData < String > Ġ= ĠMutable LiveData () ĊĠĠĠ Ġval Ġerror Delete Work out LiveData : ĠMutable LiveData < String > Ġ= ĠMutable LiveData () ĊĊĠĠĠ Ġfun Ġget Exercise ( id Work out : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġexercise Repository . getAll Exercise ( id Work out , Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsuccess Get Exercise LiveData . value Ġ= Ġit ĊĠĠĠĠĠĠĠ Ġ}, Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġerror Get Exercise LiveData . value Ġ= Ġit ĊĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget Work out ( id Work out : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġwork out Repository . get Work out ( id Work out , Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsuccess Get Work out LiveData . value Ġ= Ġit ĊĠĠĠĠĠĠĠ Ġ}, Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġerror Get Work out LiveData . value Ġ= Ġit ĊĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdelete Work out ( id Work out : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġwork out Repository . delete Work out ( id Work out , Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsuccess Delete Work out LiveData . value Ġ= Ġit ĊĠĠĠĠĠĠĠ Ġ}, Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġerror Delete Work out LiveData . value Ġ= Ġit ĊĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠ Ġ} Ċ }