public async Task <IActionResult> GetAllStations([FromQuery(Name = "from")] int from = 0, [FromQuery(Name = "to")] int to = 4)
        {
            //System.Threading.Thread.Sleep(500); // Fake latency
            var quantity = to - from;

            // We should also avoid going too far in the list.
            if (quantity <= 0)
            {
                return(BadRequest("You cannot have the 'to' parameter higher than 'from' parameter."));
            }
            else if (from < 0)
            {
                return(BadRequest("You cannot go in the negative with the 'from' parameter"));
            }

            var allStations = await _stationService.GetAllStations();

            var result = new
            {
                Total    = allStations.Count(),
                Stations = allStations.Skip(from).Take(quantity).ToArray()
            };

            return(Ok(result));
        }
        public IHttpActionResult AllStations()
        {
            var stations = _stationService.GetAllStations();

            if (stations != null)
            {
                var stationDTOs = stations as List <StationDTO> ?? stations.ToList();
                if (stationDTOs.Any())
                {
                    return(Ok(stationDTOs));
                }
            }
            return(NotFound());
        }
 public List <BicycleStation> GetAllStations()
 {
     return(_service.GetAllStations());
 }
        public void WhenGettingAllStations_AssertReturnedCollection()
        {
            var stations = _stationService.GetAllStations();

            Assert.Equal(DataInitializer.GetAllStations().Count, stations.Count());
        }