// GET: Goods public ActionResult GoodsIndex(int?tid_1, int?typeid_1, int?typeid_2, string txt = "") { //清空session数据 Session.Remove("Goods"); Session.Remove("Goods_tid"); Session.Remove("Goods_typeid"); //获得所有分类数据 ViewBag.Type = TypeTableBll.SelectAllType(); ViewBag.GoodsPhoto = GoodsPhotoBll.SelectAllGoodsPhoto(); if (tid_1 != null) { //根据tid查询 Session["Goods_tid"] = GoodsBll.SelectTidGoods(tid_1 ?? 0); //ViewBag.tid = tid_1 ?? 0; } else if (typeid_1 != null) { //根据tiyeid查询 Session["Goods_typeid"] = GoodsBll.SelectTypeidGoods(typeid_1 ?? 0); } else if (typeid_2 != null) { Session["Goods_typeid_2"] = GoodsBll.SelectType1Goods(typeid_2 ?? 0); } else { Session["Goods"] = GoodsBll.SelectAllGoods().Where(p => p.GoodsName.Contains(txt) && p.IsDelte == 0).OrderBy(p => p.GoodsHot).ToList(); } return(View()); }