public async Task <List <Position> > GetPositions(PositionQuery query) { return(await this.databaseContext.Positions .AsNoTracking() .AsQueryable() .Where(query.LocaleId, localeId => position => position.Zone !.LocaleId == localeId) .Where(query.ZoneId, zoneId => position => position.ZoneId == zoneId) .Include(query.IncludeZone, position => position.Zone) .Include(query.IncludeCalibrations, positions => positions.Calibrations !) .Include(query.IncludeData, position => position.PositionSignalData !) .ToListAsync()); }
public async Task <Position> FindPositionById(int positionId, PositionQuery?query = null) { if (query == null) { query = new PositionQuery(); } return(await this.databaseContext.Positions .Include(query.IncludeZone, position => position.Zone) .Include(query.IncludeCalibrations, positions => positions.Calibrations !) .Include(query.IncludeData, position => position.PositionSignalData !) .FirstOrDefaultAsync(position => position.Id == positionId) ?? throw NotFoundException <Position> .ById(positionId)); }