Untitled

mail@pastecode.io avatar
unknown
plain_text
13 days ago
742 B
7
Indexable
Never
public async Task<List<students>> GetAllstudents()
{
    return (await client
        .Child("students")
        .OnceAsync<students>()).Select(item => new students()
    {
        ID = item.Object.ID,
        FirstName = item.Object.FirstName,
        LastName = item.Object.LastName,
        Gender = item.Object.Gender
    }).ToList();
}

// Actual query of the data
public async Task<List<students>> Findstudents(string fnamePrefix)
{
    // Get all students once
    var queryUsers = await GetAllstudents();

    // Filter the list based on the prefix of the search query
    return queryUsers
        .Where(a => a.FirstName.StartsWith(fnamePrefix, StringComparison.CurrentCultureIgnoreCase))
        .ToList();
}
Leave a Comment