public Response FlightsAssignedToGate(int id) { IEnumerable <IFlightAssignedToGate> flights = m_InformationFinder.FlightsAssignedToGate(id); FlightsAssignedToGates response = CreateFlightsAssignedToGates(id, flights); return(AsJson(response)); }
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); }
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)); }