Beispiel #1
0
        public ApiModule(ICountDownService countDownService)
        {
            Get["/api/bustops/{code}"] = parameters => {
                var bustop = new Bustop(parameters.code);
                return(bustop.GetBustopDetails(countDownService));
            };

            Get["/api/bustops/latitude/{latitude}/longitude/{longitude}"] = _ =>
            {
                var location = new Location(_.Latitude, _.Longitude);
                return(location.GetMarkers(countDownService));
            };
        }
Beispiel #2
0
        public LocationModel GetMarkers(ICountDownService countDownService)
        {
            var locationModel = countDownService.GetMarkers(SwLat, SwLng, NeLat, NeLng);

            foreach (var marker in locationModel.Markers)
            {
                marker.Delta = Math.Abs(_latitude - marker.Lat) + Math.Abs(_longitude - marker.Lng);
            }

            locationModel.Markers = locationModel.Markers.OrderBy(m => m.Delta);

            return(locationModel);
        }
Beispiel #3
0
 public BustopModel GetBustopDetails(ICountDownService service)
 {
     return(service.GetBustopDetails(_code));
 }
Beispiel #4
0
 public ChristmasCountDownWorker(ICountDownService countDownService)
 {
     _countDownService = countDownService;
 }
Beispiel #5
0
 public IndexModule(ICountDownService countDownService)
 {
     Get["/"]                    = parameters => View["index"];
     Get["/nearbystops"]         = parameters => View["nearbystops"];
     Get["/stopcode/{stopcode}"] = _ => View["stopcode", _.stopcode];
 }
Beispiel #6
0
 public LightShowCountdownWorker(ICountDownService countDownService)
 {
     _countDownService = countDownService;
 }