/// <summary> /// 取得搜尋天氣資訊 /// </summary> /// <param name="attr"></param> /// <param name="date"></param> /// <param name="local"></param> /// <returns></returns> public ActionResult GetSearchWeather(string attr, DateTime date, string local = "桃園區") { //Initial Variables IWeather repos = DataFactory.WeatherRepository(); return(Content(JsonConvert.SerializeObject(repos.GetWeatherSearch(attr, local)), "application/json")); }
public object GetWeather(string attr, string local = "桃園區") { //Initial Variables IWeather repos = DataFactory.WeatherRepository(); return(repos.GetWeatherSearch(attr, local)); }
public IHttpActionResult GetSearchWeather(string attr, string local = "桃園區") { //Initial IHttpActionResult responseResult; IWeather repos = DataFactory.WeatherRepository(); //序列化撈出來的資料 var jsonSerialize = JsonConvert.SerializeObject(repos.GetWeatherSearch(attr, local)); //做成JSON字串包裝到最後輸出 StringContent responseMsgString = new StringContent(jsonSerialize, System.Text.Encoding.UTF8, "application/json"); HttpResponseMessage responseMsg = new HttpResponseMessage() { Content = responseMsgString }; responseResult = ResponseMessage(responseMsg); return(responseResult); }