Exemplo n.º 1
0
        public async Task <IActionResult> FindRoute(string startCity, string destinationCity,
                                                    TimeSpan hourFrom, TimeSpan hourTo, string days, DateTime date)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var result = await _routeService.FindRoutesAsync(startCity, destinationCity,
                                                             days, hourFrom, hourTo, date);

            if (!result.Any())
            {
                return(NotFound("No routes found."));
            }

            return(Ok(result));
        }