I have a class:
public class FlightDetails
{
public string FlightId {get; set;}
public string PilotName {get; set;}
public string Area {get; set;}
public string Country {get; set;}
}
Here sending response:
public async Task<List<FlightDetails>> GetFlightAsync(string FlightId)
{
//
var flights = new List<FlightDetails>();
flights = response.AllFlights;
flights = flights.Where(x => x.FlightId.Contains(FlightId)).ToList();
//
return flights;
}
Getting List
here and data is filled but issue is don't want FlightId
and Country
in the response which I am sending. How to remove this objects in the List
? Finally in the List
item there should be only PilotName
and Area
.
Update:
I forgot the following line before the flights = response.AllFlights;
var request = await _rest.Get<WorldFlights>(url + $"?FlightId={FlightId}");