Пример #1
0
        /// <summary>
        /// 廣告區管理 Index
        /// </summary>
        /// <param name="search"></param>
        /// <param name="page"></param>
        /// <param name="siteId"></param>
        /// <param name="menuId"></param>
        /// <returns></returns>
        public ActionResult Index(AdvertisementSearchModel search, int?page, long siteId = 1, long menuId = 2000)
        {
            ViewBag.SiteID = siteId;
            ViewBag.MenuID = menuId;

            if (Request.HttpMethod == "GET")
            {
                if (page == null)
                {
                    WorkV3.Common.Utility.ClearSearchValue();
                }
                else
                {
                    AdvertisementSearchModel prevSearch = WorkV3.Common.Utility.GetSearchValue <AdvertisementSearchModel>();
                    if (prevSearch != null)
                    {
                        search = prevSearch;
                    }
                }
            }
            else if (Request.HttpMethod == "POST")
            {
                WorkV3.Common.Utility.SetSearchValue(search);
                ViewBag.IsSearchMode = "IsSearchMode";
            }
            ViewBag.Search = search;

            List <AdvertisementModel> list = new List <AdvertisementModel>();
            Pagination pagination          = new Pagination
            {
                PageIndex = page ?? 1,
                PageSize  = WebInfo.PageSize
            };
            int totalRecord = 0;

            list = AdvertisementDAO.GetAdvertisement(search, pagination.PageSize, pagination.PageIndex, siteId, out totalRecord);
            pagination.TotalRecord = totalRecord;
            ViewBag.Pagination     = pagination;


            return(View(list));
        }