This repository has been archived on 2026-05-26. You can view files and clone it. You cannot open issues or pull requests or push a commit.
2019-05-26 18:40:02 +02:00
|
|
|
package com.denizd.substitutionplan
|
|
|
|
|
|
|
|
|
|
import android.app.Application
|
|
|
|
|
import androidx.lifecycle.AndroidViewModel
|
|
|
|
|
import androidx.lifecycle.LiveData
|
|
|
|
|
|
|
|
|
|
public class SubstViewModel(application: Application) : AndroidViewModel(application) {
|
|
|
|
|
|
|
|
|
|
private val repository: SubstRepository
|
|
|
|
|
val allSubst: LiveData<List<Subst>>?
|
|
|
|
|
|
|
|
|
|
init {
|
|
|
|
|
repository = SubstRepository(application)
|
|
|
|
|
allSubst = repository.allSubst
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-02 17:57:57 +02:00
|
|
|
fun insertSubst(subst: Subst) {
|
2019-05-26 18:40:02 +02:00
|
|
|
repository.insert(subst)
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-02 17:57:57 +02:00
|
|
|
fun updateSubst(subst: Subst) {
|
2019-05-26 18:40:02 +02:00
|
|
|
repository.update(subst)
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-02 17:57:57 +02:00
|
|
|
fun deleteSubst(subst: Subst) {
|
2019-05-26 18:40:02 +02:00
|
|
|
repository.delete(subst)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun deleteAllSubst() {
|
|
|
|
|
repository.deleteAllSubst()
|
|
|
|
|
}
|
|
|
|
|
}
|