Ejemplo n.º 1
0
 public async Task <List <Location> > GetLocation([Service] MyDbContext dbContext, string code) =>
 await dbContext.Locations
 .AsNoTracking()
 .Where(l => l.Code == code)
 .OrderBy(l => l.Name)
 .ToListAsync();
Ejemplo n.º 2
0
 /// <summary>
 /// Return a list of all locations
 /// Notice the [Service]. It's an auto look-up from HotChocolate
 /// </summary>
 /// <param name="dbContext"></param>
 /// <returns></returns>
 public async Task <List <Location> > GetLocations([Service] MyDbContext dbContext) =>
 await dbContext.Locations
 .AsNoTracking()
 .OrderBy(l => l.Name)
 .ToListAsync();