示例#1
0
        public Response FlightsAssignedToGate(int id)
        {
            IEnumerable <IFlightAssignedToGate> flights = m_InformationFinder.FlightsAssignedToGate(id);

            FlightsAssignedToGates response = CreateFlightsAssignedToGates(id,
                                                                           flights);

            return(AsJson(response));
        }
示例#2
0
        private static FlightsAssignedToGates CreateFlightsAssignedToGates(
            int gateId,
            IEnumerable <IFlightAssignedToGate> assigned)
        {
            int[] flightId = assigned.Select(x => x.FlightId).ToArray();

            var instance = new FlightsAssignedToGates
            {
                GateId    = gateId,
                FlightIds = flightId
            };

            return(instance);
        }
示例#3
0
        public Response List()
        {
            var response = new List <IFlightsAssignedToGates>();

            IEnumerable <IGrouping <int, IFlightAssignedToGate> > groupBy =
                m_InformationFinder.List().GroupBy(x => x.GateId);

            foreach (IGrouping <int, IFlightAssignedToGate> group in groupBy)
            {
                FlightsAssignedToGates flightsAssignedToGates = CreateFlightsAssignedToGates(
                    group.Key,
                    group);

                response.Add(flightsAssignedToGates);
            }

            return(AsJson(response));
        }