コード例 #1
0
        public ActionResult Search(string S = "")
        {
            try
            {
                if (S != "")
                {
                    NewsEntity.Models.Search theSearch = new NewsEntity.Models.Search();
                    theSearch.S = S;
                    theSearch.Save();

                    var NewsView = new NewsMain(false, S);
                    return(View(NewsView));
                }
                return(RedirectToAction("Index", "Home"));
            }
            catch (Exception ex)
            {
                string err = ex.Message;
                if (ex.InnerException != null)
                {
                    err += ": " + ex.InnerException.Message;
                }
                var theView = new Models.NewsMain(false);
                theView.Error = err;
                return(View(theView));
            }
        }
コード例 #2
0
        /// <summary>
        /// 依據頁碼決定下載的新聞數量
        /// </summary>
        /// <param name="page">頁碼</param>
        public void Downloadpage(int page)
        {
            NewsMain newsMain = new NewsMain();

            newsMain.DownloadNews(10);
        }