Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help in getting data back #311

Open
eduardoagr opened this issue Feb 9, 2023 · 0 comments
Open

help in getting data back #311

eduardoagr opened this issue Feb 9, 2023 · 0 comments

Comments

@eduardoagr
Copy link

eduardoagr commented Feb 9, 2023

I have this class

`
public FirebaseServices(string databaseUrl) {
_firebaseClient = new FirebaseClient(databaseUrl);
}

    public async Task<LocalUser>? GetAsync(string Node, string id) {
        var result = await _firebaseClient
            .Child(Node).Child(id)
            .OnceSingleAsync<LocalUser>();

        if (result == null) {
            return null;
        }

        return result;
    }

    public async Task<IReadOnlyCollection<FirebaseObject<LocalUser>>> GetAllAsync(string Node) {

        var FireUsers = await _firebaseClient
           .Child(Node)
           .OnceAsync<LocalUser>();

        return FireUsers;

    }

    public async Task<FirebaseObject<LocalUser>> CreateAsync(string Node, LocalUser user) {

        var newUser = await _firebaseClient.Child(Node)
        .PostAsync(user);

        return newUser;
    }



    public async Task UpdateAsync(UserData UserToUpdate) {
        await _firebaseClient.Child(UserToUpdate.Key).PutAsync
            (UserToUpdate.Object);
    }

    public async Task DeleteAsync(string path) {
        await _firebaseClient.Child(path).DeleteAsync();
    }
}

}
`

But for some reason the GetAllAsync bring me data, but the GetAsync doesn't

this is my data

{"Key":"-NNpL5Gb1I9O5Usd12ci","Object":{"Email":"[email protected]","Password":"123456","FirstName":"a","LastName":"a","Username":"a","Confirm":null,"DateOfBirth":"2018-05-05T00:00:00","DateOfBirthString":"5/5/2018","DateOfSuscriptionStartString":"1/1/0001","DateOfSuscriptionEndString":"1/1/0001","Id":"DqPTMCpLNfeZuYBfixrIHyxmDZB2","City":"Madrid","HasPaid":false,"IsActive":false,"SuscriptionStartDate":"0001-01-01T00:00:00","SuscriptionEndDate":"0001-01-01T00:00:00","Country":"Espa\u00F1a","PhotoUrl":null,"Age":4}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant