Пример #1
0
        public bool PutUserData <T>(T DataToAdd, DbRequestType dbRequestType, string UserName)
        {
            FirebaseDB firebaseDB = null;

            switch (dbRequestType)
            {
            case DbRequestType.Users:
                firebaseDB = new FirebaseDB($"{BaseURL}");
                break;

            default:
                firebaseDB = new FirebaseDB($"{BaseURL}/{dbRequestType}");
                break;
            }

            FirebaseDB       firebaseDBTeams = firebaseDB.Node(UserName);
            var              json            = JsonConvert.SerializeObject(DataToAdd);
            FirebaseResponse getResponse     = firebaseDBTeams.Put(json);

            if (getResponse.Success)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        public List <string> GetUserInfo(string userName, DbRequestType dbRequestType)
        {
            FirebaseDB       firebaseDB      = new FirebaseDB($"{BaseURL}");
            FirebaseDB       firebaseDBTeams = firebaseDB.Node($"{userName}/{dbRequestType}");
            FirebaseResponse getResponse     = firebaseDBTeams.Get();

            Debug.WriteLine(getResponse.Success);
            if (getResponse.Success)
            {
                Debug.WriteLine(getResponse.JSONContent);
            }
            return(JsonReader <List <string> > .JsonDeserialize(getResponse.JSONContent));
        }
Пример #3
0
        public FirebaseGetUserResponse GetUserData(DbRequestType dbRequestType, string userName = "")
        {
            FirebaseDB       firebaseDB      = new FirebaseDB($"{BaseURL}");
            FirebaseDB       firebaseDBTeams = firebaseDB.Node(userName);
            FirebaseResponse getResponse     = firebaseDBTeams.Get();

            Debug.WriteLine(getResponse.Success);
            if (getResponse.Success)
            {
                Debug.WriteLine(getResponse.JSONContent);
            }
            return(JsonReader <FirebaseGetUserResponse> .JsonDeserialize(getResponse.JSONContent));
        }