public async Task <IEnumerable <TravelOptions> > Get(string origin, string destination) { MotoristaBusiness motoristaBusiness = new MotoristaBusiness(); BestRoutesBusiness bestRoutesBusiness = new BestRoutesBusiness(); MotoristaPreferencias motoristaPreferencias = motoristaBusiness.GetPreferencias(string.Empty); List <TravelOptions> lsjson = new List <TravelOptions>(); List <Options> bestRoutes = await bestRoutesBusiness.GetBestRoutes(origin, destination, motoristaPreferencias); if (bestRoutes.Any()) { foreach (var br in bestRoutes) { TravelOptions json = new TravelOptions(); json.Status = "Rota encontrada"; lsjson.Add(json); } } else { TravelOptions json = new TravelOptions(); json.Status = "Rota não encontrada."; lsjson.Add(json); } return(lsjson); }
public MotoristaPreferencias GetPreferences() { MotoristaPreferencias preferencias = new MotoristaPreferencias(); return(preferencias); }
public MotoristaPreferencias GetPreferencias(string idUser) { MotoristaPreferencias motoristaPreferencias = motoristaRepository.GetPreferences(); return(motoristaPreferencias); }
public async Task <List <Options> > GetBestRoutes(string origin, string destination, MotoristaPreferencias motoristaPreferencias) { DirectionsConsumer directionsConsumer = new DirectionsConsumer(); List <Options> lsBestRoutes = await directionsConsumer.GetBestRoutesByDirection(origin, destination, motoristaPreferencias.DepartureTime, motoristaPreferencias.ArrivalTime); return(lsBestRoutes); }