package Ġcom . ra ids . yun b ian scanner . data . view model Ċ Ċ import Ġandroid . app . Application Ċ import Ġandroidx . lifecycle . Android ViewModel Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġcom . ra ids . yun b ian scanner . data . Repository Ċ import Ġcom . ra ids . yun b ian scanner . data . model . History Ċ Ċ class ĠHistory ViewModel ( application : ĠApplication ) Ġ: ĠAndroid ViewModel ( application ) Ġ{ ĊĊĠĠĠ Ġprivate Ġvar Ġrepository : ĠRepository Ġ= ĠRepository . getRepository ( application ) ĊĊĠĠĠ Ġvar Ġall History LiveData : ĠLive Data < List < History >> Ġ= Ġrepository . getAll History Live () ĊĊĠĠĠ Ġpublic Ġfun Ġdelete History ById ( id : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġrepository . delete History ById ( id ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġinsert History ( history : ĠHistory ) Ġ{ ĊĠĠĠĠĠĠĠ Ġrepository . insert History ( history ) ĊĠĠĠ Ġ} Ċ }