public ActionResult Index(string Search)
        {
            GuestbookView Data = new GuestbookView();

            Data.DataList = guestbookDBService.GetGuestbooks(Search);
            return(View(Data));
        }
示例#2
0
        // GET: Guestbook
        public ActionResult Index()
        {
            GuestbookView data = new GuestbookView();

            data.DataList = guestbookDBService.GetDataList();

            return(View(data));
        }
        public ActionResult GetDataList(string Search, int Page = 1)
        {
            GuestbookView Data = new GuestbookView();

            Data.Search   = Search;
            Data.Paging   = new ForPaging(Page);
            Data.DataList = guestbookService.GetDataList(Data.Paging, Data.Search);
            return(PartialView(Data));
        }
示例#4
0
        public ActionResult Guest(GuestbookView gb)
        {
            var     config = new MapperConfiguration(cfg => cfg.CreateMap <GuestbookView, GuestbookDTO>());
            IMapper mapper = config.CreateMapper();

            mapper.Map <GuestbookView, GuestbookDTO>(gb);
            guestbookServices.AddToGuestbook(mapper.Map <GuestbookView, GuestbookDTO>(gb));
            return(RedirectToAction("Guest"));
        }
示例#5
0
        // GET: Guestbook
        public ActionResult Index()
        {
            //宣告一個新頁面模型
            GuestbookView Data = new GuestbookView();

            //從Service 中取得頁面所需陣列資料
            Data.DataList = guestbookservice.GetDataList();

            //將頁面資料傳入View中
            return(View(Data));
        }
示例#6
0
        // GET: Guestbook
        //public ActionResult Index()
        //{
        //    return View();
        //}
        public ActionResult Index(string Search, int Page = 1)
        {
            //宣告一個新頁面模型
            GuestbookView Data = new GuestbookView();

            Data.Search   = Search;
            Data.Paging   = new ForPaging(Page);
            Data.DataList = guestbookService.GetDataList(Data.Paging, Data.Search);

            return(View(Data));
        }
示例#7
0
        /*public ActionResult Index()
         * {
         *  //宣告一個新頁面模型
         *  GuestbookView Data = new GuestbookView();
         *  //從Service中取得頁面所需陣列資料
         *  Data.DataList = guestbookService.GetDataList();
         *  //將頁面資料傳入View中
         *  return View(Data);
         * }*/


        #region 開始頁面
        public ActionResult Index(string Search)
        {
            //宣告一個新頁面模型
            GuestbookView Data = new GuestbookView();

            //將傳入值Search(搜尋)放入頁面模型中
            Data.Search = Search;
            //從Service中取得頁面所需陣列資料
            Data.DataList = guestbookService.GetDataList(Data.Search);
            //將頁面資料傳入View中
            return(View(Data));
        }
示例#8
0
        //取得資料陣列用Action,將Page(頁數)預設為1
        public ActionResult GetDataList(string Search, int Page = 1)
        {
            //宣告一個新頁面模型
            GuestbookView Data = new GuestbookView();

            //將傳入值Search(搜尋)放入頁面模型中
            Data.Search = Search;
            //新增頁面模型中的分頁
            Data.Paging = new ForPaging(Page);
            //從Service中取得頁面所需陣列資料
            Data.DataList = guestbookService.GetDataList(Data.Paging, Data.Search);
            //將頁面資料傳入View中
            return(PartialView(Data));
        }
示例#9
0
 [HttpPost] //設定搜尋為接受頁面POST傳入
 //使用Bind的Inculde來定義只接受的欄位,用來避免傳入其他不相干值
 public ActionResult GetDataList([Bind(Include = "Search")] GuestbookView Data)
 {
     //重新導向頁面至開始頁面,並傳入搜尋值
     return(RedirectToAction("GetDataList", new { Search = Data.Search }));
 }