コード例 #1
0
        // GET: ProductInfo
        public ActionResult ProductInfo()
        {
            //查询出商品信息
            var code = Request["id"];
            ViewBag.code = Request["id"];
            var pro = ProService.GetEntity(x => x.Code == code);
            ViewBag.name = pro.Name;
            ViewBag.describe = pro.Describe;//描述
            ViewBag.price = pro.Price;
            ViewBag.img = pro.img;
            //遍历出来图片
            //for(int i=0;i < pro.img.Split(',').Length;i++)
            //{
            //    ViewBag.img[i] = pro.img.Split(',')[i];
            //}
            ViewBag.img1 = pro.img.Split(',')[0];
            ViewBag.img2 = pro.img.Split(',')[1];
            //  ViewBag.img3 = pro.img.Split(',')[2];
            //根据商品查询出来库存
            Stock stock = StockService.GetEntity(x => x.BillId == code);
            ViewBag.stock = stock.num;
            PropertyInfo[] pis = typeof(Stock).GetProperties();//反射  暂时用不到,用来遍历实体用
            //根据商品查询处商品规格
            int? id = pro.SpecificationId;
            Specification specification = SpecificationService.GetEntity(x => x.Id == id);
            var specification1 = SpecificationService.GetEntities(x => x.ProCode == pro.Code);
            ViewBag.Spcification = specification1;
            //产品描述
            ViewBag.describe = pro.Describe;
            //用户评价
            var proDuctReview = ProductReviewService.GetEntities(x => x.Pcode == pro.Code);
            ViewBag.ProReview = proDuctReview.ToList();

            return View();
        }
コード例 #2
0
        public ActionResult seachHtml1()
        {
            string seach    = Request["seach"];
            string sea      = "%seach%";
            var    seachAll = ProService.GetEntities(x => x.Name == sea);

            return(Content(seachAll.Count().ToString()));
        }
コード例 #3
0
        //查询推荐信息
        public ActionResult tuijian()
        {
            //查询推荐商品信息
            var GetPro = ProService.GetEntities(x => true).OrderByDescending(x => x.IsHot).Take(1);

            ViewBag.Pro = GetPro.ToList();
            return(PartialView());
        }
コード例 #4
0
        //查询热销信息
        public ActionResult HotSell()
        {
            //查询热销商品信息 WxShop_Model Fish_Model
            var GetPro = ProService.GetEntities(x => x.IsHot = true).Take(3);

            ViewBag.Pro = GetPro.ToList();
            return(PartialView());
        }