public IEnumerable <Entities.PublicStopPoint> GetNearby(int limit, Coordinate location) { // Filter out operators not selected. IEnumerable <OperatorSetting> operatorSettings = Context.OperatorSettings.Where(x => x.IsEnabled); return(base.DbSet.Where(x => operatorSettings.Select(y => y.OperatorName).Contains(x.OperatorName)).SelectMany(x => x.StopPoints).ToList().OrderBy(x => x.Location.DistanceToCoordinateInMetres(location)).Take(limit).Select(x => EntityModelFactory.CreatePointForMap(x))); }
public IEnumerable <Entities.PublicStopPoint> GetPointsForMap() { // Filter out operators not selected. IEnumerable <OperatorSetting> operatorSettings = Context.OperatorSettings.Where(x => x.IsEnabled); return(base.DbSet.Where(x => operatorSettings.Select(y => y.OperatorName).Contains(x.OperatorName)).Select(x => x.StopPoints.First()).Select(x => EntityModelFactory.CreatePointForMap(x))); }