public Flights GetFlights(FlightQuery flightQuery) { Flights fs; try { fs = TicketSellingQueryLogic.Instance.GetFlights(flightQuery); } catch (Exception e) { throw new FaultException(e.Message); } return(fs); }
/// <summary> /// Gets a query and returns the suitable flights /// </summary> /// <param name="flightQuery">the query</param> /// <returns>returns the needed flights</returns> public Flights GetFlights(FlightQuery flightQuery) { Flights suitableFlights = new Flights(); foreach (Flight flight in flights) { // Checks if the flight fits the query if (flight.src.Equals(flightQuery.src) && flight.dst.Equals(flightQuery.dst)) { if (flightQuery.date.Equals(flight.date)) { suitableFlights.Add(flight); } } } return(suitableFlights); }