コード例 #1
0
ファイル: MarketController.cs プロジェクト: war-man/Cfood
        public ActionResult Index(int?pType, int?pPage)
        {
            MarketPage mMarketPage = new MarketPage();

            if (pType == null)
            {
                if (Session["MarketType"] != null)
                {
                    pType = (int)Session["MarketType"];
                }
                else
                {
                    pType = 0;
                }
            }
            else
            {
                Session["MarketType"] = pType;
            }
            if (pPage == null)
            {
                if (Session["MarketPage"] != null)
                {
                    pPage = (int)Session["MarketPage"];
                }
                else
                {
                    pPage = 1;
                }
            }
            else
            {
                Session["MarketPage"] = pPage;
            }
            #endregion
            /*Lay danh sach cac tin theo page*/
            var mMarketList = MarketService.LayMarketTheoTrangAndType((int)pPage, 10, (int)pType);
            if (mMarketList.Count < 10)
            {
                mMarketPage.IsEnd = true;
            }
            //Tao Html cho danh sach tin nay
            mMarketPage.Html   = V308HTMLHELPER.TaoDanhSachCacMarket(mMarketList, (int)pPage);
            mMarketPage.Page   = (int)pPage;
            mMarketPage.TypeId = (int)pType;
            return(View("Index", mMarketPage));
        }