Esempio n. 1
0
        public async Task <IActionResult> BusDepartureTimes(int busId)
        {
            var departureTimes = await busService.GetBusDepartureTimes(busId);

            if (departureTimes.Value?.Length == 0)
            {
                return(BadRequest(new ApiError("No departure times info for the bus")));
            }
            departureTimes.Self = LinkGenerator.ToCollection(RouteNames.DepartureTimes, new { busId });
            return(Ok(departureTimes));
        }