Example #1
0
        public ActionResult GetProduct(int id = 0, int orderid = 1, int page = 1)
        {
            var preproducts = db.ProductColors.Where(p => p.Product.ActivityProducts.Where(a => a.Activity.EndDate >= DateTime.Now).FirstOrDefault().Activity.ActivityID == id && p.Product.ActivityProducts.Where(a => a.Activity.EndDate >= DateTime.Now).FirstOrDefault().Activity.ActivityName != null);

            var products    = ProductMethod.CreateProductCells(preproducts);
            int pages       = products.Count();
            var orderresult = ProductMethod.SetCellsByOrder(products, orderid).Skip((page - 1) * 16).Take(16);


            return(Json(new { pages = pages, datas = orderresult.ToList() }, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        //塊狀商品展示
        public ActionResult GetProduct(int id = 1, int sid = 0, int orderid = 1, int page = 1)
        {
            IQueryable <ProductColor> preproducts = (sid != 0) ? db.ProductColors.Where(p => p.Product.CategorySID == sid) : db.ProductColors.Where(p => p.Product.CategorySmall.CategoryMID == id);

            var products = ProductMethod.CreateProductCells(preproducts);
            int pages    = products.Count();

            var orderresult = ProductMethod.SetCellsByOrder(products, orderid).Skip((page - 1) * 16).Take(16);

            return(Json(new { pages = pages, datas = orderresult.ToList() }, JsonRequestBehavior.AllowGet));
        }