-
-
Save shorthouse/f81ab94ef7ecd95202b6230b5564bb80 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MovieViewModel(private val movieDao: MovieDao): ViewModel() { | |
// ... | |
fun updateMovieName(newText: TextFieldValue) { | |
_movieName.value = newText | |
} | |
fun insertMovie(movieName: String) { | |
viewModelScope.launch { | |
movieDao.insert(Movie(name = movieName)) | |
} | |
} | |
fun deleteMovies() { | |
viewModelScope.launch { | |
movieDao.deleteMovies() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment