/// <summary> /// 取得搜尋潮汐資訊(金門) /// </summary> /// <param name="local">鄉鎮地區關鍵字 /// "金門縣金城鎮", "金門縣金沙鎮", "金門縣金湖鎮", "金門縣金寧鄉", "金門縣烈嶼鄉", "金門縣烏坵鄉"</param> /// <returns></returns> public ActionResult GetTidalInfo(string local = "金門縣金城鎮") { //Initial Variables ITidal repos = DataFactory.TidalRepository(); return(Content(JsonConvert.SerializeObject(repos.getTidalInfo(local)), "application/json")); }
public IHttpActionResult GetSearchTidal(string local = "金門縣金城鎮") { //Initial IHttpActionResult responseResult; ITidal repos = DataFactory.TidalRepository(); //序列化撈出來的資料 var jsonSerialize = JsonConvert.SerializeObject(repos.getTidalInfo(local)); //做成JSON字串包裝到最後輸出 StringContent responseMsgString = new StringContent(jsonSerialize, System.Text.Encoding.UTF8, "application/json"); HttpResponseMessage responseMsg = new HttpResponseMessage() { Content = responseMsgString }; responseResult = ResponseMessage(responseMsg); return(responseResult); }