// GET api/<controller> public IEnumerable <AirportCodeSearch> Get(string query = "", string filterOption = null) { string newfilterOptions = null; using (var db = new AirportDataDB()) { if (filterOption == "0") { newfilterOptions = null; } else { newfilterOptions = filterOption; } List <AirportCodeSearch> eItem = db.Database.SqlQuery <AirportCodeSearch>("[dbo].[AirportCode_SelectAC] @p0, @p1", query, newfilterOptions).ToList(); return(eItem.ToList()); } }