Exemple #1
0
        public override string ManageLocations()
        {
            try
            {
                ILocationsData locationsData = dataFactory.CreateLocationsData();
                ILocations     locations     = locationsData.GetLocationsAll();

                IFlagImageData flagImageData = dataFactory.CreateFlagImageData();
                flagImageData.AddFlagsToCountries(locations.countries);

                IBackupData backupData = dataFactory.CreateBackupData();
                backupData.SetBackup(locations);

                List <IEntity> entities = entityFactory.CreateEntities();
                entities.Add(locations);

                return(responseFactory.CreateResponse("", entities));
            }
            catch (Exception ex)
            {
                string message = String.Format("Exception caught: {0}", ex);
                logger.LogMessage(message);
                return(responseFactory.CreateResponse(message, null));
            }
        }
Exemple #2
0
        public override List <IFlight> GetFlightsByTripParams(ITripParams tripParams)
        {
            List <IFlight> flights = flightData.GetDirectFlightsByTripParams(tripParams);

            if (flights.Count() > 0)
            {
                backupData.SetBackup(flights.ToArray()[0]);
            }

            return(flights);
        }
Exemple #3
0
        private List <IRoute> SortAndCutRoutes(List <IRoute> routes)
        {
            routes = routes.OrderBy(o => o.best).ToList();
            try
            {
                routes.RemoveRange(maxRoutesReturn, routes.Count() - maxRoutesReturn);
            }
            catch (Exception)
            {
                // some comment
            }

            if (routes.Count() > 0)
            {
                backupData.SetBackup(routes[0]);
            }

            return(routes);
        }