Beispiel #1
0
        public ActionResult Detail(int pId = 0)
        {
            try {
                ProductDetailPage mProductDetailPage = new ProductDetailPage();
                Product           mProduct;
                ProductType       mProductType = new ProductType();
                Market            mMarket      = new Market();;
                //List<Product> MarketList;
                List <Product> RelatedList;
                //List<Product> DiscountList;
                List <ProductType> mProductTypeList;
                mProduct = ProductRepos.LayTheoId(pId);
                if (mProduct != null)
                {
                    mProductDetailPage.Product = mProduct;
                    mMarket = MarketRepos.LayTheoId((int)mProduct.MarketId);
                    if (mMarket == null)
                    {
                        mMarket = new Market();
                    }
                    mProductDetailPage.Market = mMarket;
                    //lay chi tiet ve loai san pham
                    mProductType = ProductRepos.LayLoaiSanPhamTheoId((int)mProduct.Type);
                    if (mProductType == null)
                    {
                        mProductType = new ProductType();
                    }
                    mProductDetailPage.ProductType = mProductType;
                    //lay danh sach san pham cua sieu thi
                    //MarketList = productRepos.getByPageSizeMarketId(1, 6, mMarket.ID);
                    //mProductDetailPage.MarketList = MarketList;

                    RelatedList = ProductRepos.LayDanhSachSanPhamLienQuan((int)mProduct.Type, 12, true);
                    mProductDetailPage.RelatedList = RelatedList;

                    //DiscountList = productRepos.LaySanPhamKhuyenMai(1, 6);
                    //mProductDetailPage.DiscountList = DiscountList;
                    //
                    mProductTypeList = ProductRepos.getProductTypeParent();
                    mProductDetailPage.ProductTypeList = mProductTypeList;

                    ProductSlideShow ProductImages = new ProductSlideShow();

                    mProductDetailPage.Images = ProductRepos.LayProductImageTheoIDProduct(mProduct.ID);
                }
                mProductDetailPage.ProductLastest = ProductRepos.getProductsRandom(6);

                //lay chi tiet san pham
                return(View("Detail", mProductDetailPage));
                //if (!Request.Browser.IsMobileDevice)
                //    return View("Detail", mProductDetailPage);
                //else
                //    return View("MobileDetail", mProductDetailPage);
            }
            catch (Exception ex)
            {
                return(Content(ex.ToString()));
            }
        }
Beispiel #2
0
        public ActionResult ProductDetailSlide(Product pro)
        {
            ProductSlideShow productImages = new ProductSlideShow();

            if (pro.ID > 0)
            {
                productImages.Images = ProductsService.LayProductImageTheoIDProduct(pro.ID);
            }

            string view = "~/Views/themes/" + Theme.domain + "/Product_div/SlideShowDetail.cshtml";

            return(View(view, productImages));
        }