public IHttpActionResult GetByFilter(string airline = "", string destination = "", string origin = "", int flight = 0) { try { if (!string.IsNullOrEmpty(airline)) { airline = airline.TrimStart(); return(Ok(anonymousUser.GetFlightsByAirlineName(airline))); } if (!string.IsNullOrEmpty(destination)) { destination = destination.TrimStart(); return(Ok(anonymousUser.GetFlightsByDesCountryNameFromDb(destination))); } if (!string.IsNullOrEmpty(origin)) { origin = origin.TrimStart(); return(Ok(anonymousUser.GetFlightsByOriginCountryName(origin))); } if (flight > 0) { return(Ok(anonymousUser.GetFlightsByFlightNum(flight))); } } catch (Exception) { } return(BadRequest("The details you entered are not correct.")); }