Пример #1
0
 public async Task <List <Zone> > GetZones(ZoneQuery query)
 {
     return(await this.databaseContext.Zones
            .AsNoTracking()
            .AsQueryable()
            .Where(query.LocaleId, localeId => zone => zone.LocaleId == localeId)
            .Where(query.Floor, floor => zone => zone.Floor == floor)
            .Include(query.IncludePositions, zone => zone.Positions)
            .Include(query.IncludePositionsCalibrations, zone => zone.Positions !, positions => positions.Calibrations !)
            .Include(query.IncludePositionsSignalsData, zone => zone.Positions !, position => position.PositionSignalData !)
            .ToListAsync());
 }
Пример #2
0
        public async Task <Zone> FindZoneById(int zoneId, ZoneQuery?query = null)
        {
            if (query == null)
            {
                query = new ZoneQuery();
            }

            return(await this.databaseContext.Zones
                   .Include(query.IncludePositions, zone => zone.Positions)
                   .Include(query.IncludePositionsCalibrations, zone => zone.Positions !, positions => positions.Calibrations !)
                   .Include(query.IncludePositionsSignalsData, zone => zone.Positions !, position => position.PositionSignalData !)
                   .FirstOrDefaultAsync(zone => zone.Id == zoneId)
                   ?? throw NotFoundException <Zone> .ById(zoneId));
        }