package safeluck.drive.evaluation.DB;
|
|
import android.app.Application;
|
|
import androidx.annotation.NonNull;
|
import androidx.lifecycle.AndroidViewModel;
|
import androidx.lifecycle.LiveData;
|
|
import java.util.List;
|
|
/**
|
* MyApplication2
|
* Created by lzw on 2019/11/25. 11:34:24
|
* 邮箱:632393724@qq.com
|
* All Rights Saved! Chongqing AnYun Tech co. LTD
|
*/
|
public class WokViewModel extends AndroidViewModel {
|
public WokViewModel(@NonNull Application application) {
|
super(application);
|
workRepository = new WorkRepository(application);
|
mStudents = workRepository.getAllStudents();
|
}
|
|
private WorkRepository workRepository;
|
private LiveData<List<Student>> mStudents;
|
|
public LiveData<List<Student>> getStudents() {
|
return mStudents;
|
}
|
|
public void insertStudent(Student student){
|
workRepository.insert(student);
|
}
|
|
|
}
|