Created
November 17, 2019 16:35
-
-
Save gastsail/a7ad68a436b9431d5d933f28781184b7 to your computer and use it in GitHub Desktop.
UserDaoGist
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
fun postEventData(email:String,name:String,surname:String,dollarqty:Int):LiveData<Resource<Boolean>>{ | |
val datastatus = MutableLiveData<Resource<Boolean>>() | |
val userData = User(email,name,surname,dollarqty) | |
FirebaseFirestore.getInstance() | |
.collection("purchases") | |
.add(userData) | |
.addOnCompleteListener { | |
if(it.isSuccessful) datastatus.value = Resource.success(true) | |
}.addOnFailureListener { | |
datastatus.value = Resource.error(it.message!!,false) | |
} | |
return datastatus | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment