Untitled

mail@pastecode.io avatar
unknown
plain_text
22 days ago
773 B
10
Indexable
Never
//Getting All data

        public async Task<List<Users>> GetAllUsers()

        {

            return (await client
                .Child("Users")
                .OnceAsync<Users>()).Select(item => new Users
            {
                FirstName = item.Object.FirstName,
                LastName = item.Object.LastName
            }).ToList();
        }

        //Actual query of the data
        public async Task<List<Users>> FindUser(string fname)
        {
            var queryUsers = await GetAllUsers();
            await client
                .Child("Users")
                .OnceAsync<Users>();
            return queryUsers.Where(a => string.Equals(a.FirstName, fname, StringComparison.CurrentCultureIgnoreCase)).ToList();
        }
Leave a Comment