Esempio n. 1
0
        /// <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"));
        }
Esempio n. 2
0
        public object GetWeather(string attr, string local = "桃園區")
        {
            //Initial Variables
            IWeather repos = DataFactory.WeatherRepository();

            return(repos.GetWeatherSearch(attr, local));
        }
Esempio n. 3
0
        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);
        }