public ActionResult AllStoreShow(string keyString)
        {
            keyString = Request.Form["keyString"];
            List <AllStoreViewModel> models = new List <AllStoreViewModel>();

            foreach (TB_STORE store in db.TB_STORE.Where(a => a.NAME.Contains(keyString)).ToList())
            {
                AllStoreViewModel item = new AllStoreViewModel();
                item.store_name = store.NAME;
                item.rank       = (int?)store.QUALITY_RATING;
                item.store_id   = (int?)store.ID;
                List <ProductWithPicture_2_0> products = new List <ProductWithPicture_2_0>();
                Products p_db = new Products();
                foreach (TB_PRODUCT temp_item in p_db.TB_PRODUCT.Where(a => a.S_ID == store.ID).ToList())
                {
                    ProductWithPicture_2_0 pwp = new ProductWithPicture_2_0();
                    Pro_pics pic_db            = new Pro_pics();
                    pwp.product = temp_item;

                    TB_PRO_PIC pic = pic_db.TB_PRO_PIC.Where(a => a.P_ID == temp_item.ID && a.S_ID == temp_item.S_ID).First();
                    if (pic != null)
                    {
                        pwp.PICTURE = pic.PICTURE;
                    }
                    products.Add(pwp);
                }

                item.products = new List <ProductWithPicture_2_0>();
                int i = 0;
                while (i < 5 && i < products.Count)
                {
                    item.products.Add(products[i]);
                    i++;
                }
                models.Add(item);
            }
            ViewData["StoreKeyString"] = "所有";
            return(View(models));
        }
        public ActionResult AllStoreShow(string keyString)
        {
            keyString = Request.Form["keyString"];
            List<AllStoreViewModel> models = new List<AllStoreViewModel>();
            foreach (TB_STORE store in db.TB_STORE.Where(a => a.NAME.Contains(keyString)).ToList())
            {
                AllStoreViewModel item = new AllStoreViewModel();
                item.store_name = store.NAME;
                item.rank = (int?)store.QUALITY_RATING;
                item.store_id = (int?)store.ID;
                List<ProductWithPicture_2_0> products = new List<ProductWithPicture_2_0>();
                Products p_db = new Products();
                foreach (TB_PRODUCT temp_item in p_db.TB_PRODUCT.Where(a => a.S_ID == store.ID).ToList())
                {
                    ProductWithPicture_2_0 pwp = new ProductWithPicture_2_0();
                    Pro_pics pic_db = new Pro_pics();
                    pwp.product = temp_item;

                    TB_PRO_PIC pic = pic_db.TB_PRO_PIC.Where(a => a.P_ID == temp_item.ID && a.S_ID == temp_item.S_ID).First();
                    if (pic != null)
                    {
                        pwp.PICTURE = pic.PICTURE;
                    }
                    products.Add(pwp);
                }

                item.products = new List<ProductWithPicture_2_0>();
                int i = 0;
                while (i < 5 && i < products.Count)
                {
                    item.products.Add(products[i]);
                    i++;
                }
                models.Add(item);
            }
            ViewData["StoreKeyString"] = "所有";
            return View(models);
        }