Ejemplo n.º 1
0
    private async Task <List <LightningAddressData> > GetCore(ApplicationDbContext context, LightningAddressQuery query)
    {
        IQueryable <LightningAddressData?> queryable = context.LightningAddresses.AsQueryable();

        query.Usernames = query.Usernames?.Select(NormalizeUsername)?.ToArray();
        if (query.Usernames is not null)
        {
            queryable = queryable.Where(data => query.Usernames.Contains(data !.Username));
        }

        if (query.StoreIds is not null)
        {
            queryable = queryable.Where(data => query.StoreIds.Contains(data !.StoreDataId));
        }

#pragma warning disable CS8619 // Nullability of reference types in value doesn't match target type.
        return(await queryable.ToListAsync());

#pragma warning restore CS8619 // Nullability of reference types in value doesn't match target type.
    }
Ejemplo n.º 2
0
 public async Task <List <LightningAddressData> > Get(LightningAddressQuery query)
 {
     await using var context = _applicationDbContextFactory.CreateContext();
     return(await GetCore(context, query));
 }