public ActionResult GetRealTime(float y, float x, int radius) { //Initialize IRealTime repos = DataFactory.RealTimeRepository(); //return radius range Info return(Content(JsonConvert.SerializeObject(repos.getRealTimeInfo(y, x, radius)), "application/json")); }
/// <summary> /// 取得即時路況(全台) /// </summary> /// <param name="radius">半徑範圍(公尺)</param> /// <param name="x">經度</param> /// <param name="y">緯度</param> /// <returns></returns> public List <RealTimeInfoDeserialize> GetRealTime(float y, float x, int radius) { //Initialize IRealTime repos = DataFactory.RealTimeRepository(); //return radius range Info return(repos.getRealTimeInfo(y, x, radius)); }
public IHttpActionResult GetSearchWeather(float y, float x, int radius) { //Initial IHttpActionResult responseResult; IRealTime repos = DataFactory.RealTimeRepository(); //序列化撈出來的資料 var jsonSerialize = JsonConvert.SerializeObject(repos.getRealTimeInfo(y, x, radius)); //做成JSON字串包裝到最後輸出 StringContent responseMsgString = new StringContent(jsonSerialize, System.Text.Encoding.UTF8, "application/json"); HttpResponseMessage responseMsg = new HttpResponseMessage() { Content = responseMsgString }; responseResult = ResponseMessage(responseMsg); return(responseResult); }