public void GetUserByID(string userID, Delegates.GetUserByID getUserById) { FirebaseDatabase.DefaultInstance.GetReference(DBTable.User.ToString()).Child(userID) .GetValueAsync().ContinueWith(task => { if (task.IsFaulted) { Debug.Log("Falha no get user by id"); } else if (task.IsCompleted) { DataSnapshot snapshot = task.Result; var userJson = snapshot.GetRawJsonValue(); var user = JsonUtility.FromJson <UserModel> (userJson); // GetUserAppointments (user.userID, delegate(List<AppointmentModel> appointments) { // user.appoitments = new Dictionary<string, object> (); // foreach (var appointment in appointments) { // user.appoitments.Add (appointment.appointmentID, (object)appointment); // } // getUserById (user); // }, delegate(string error) { // Debug.Log ("Falha no get user by id"); // }); getUserById(user); } }); }
public static void GetUserById(string userID, Delegates.GetUserByID getUserSucess) { FireBaseManager.GetFireBaseInstance().GetUserByID(userID, delegate(UserModel user) { getUserSucess(user); }); }