Beispiel #1
0
        public ActionResult Market(string pMarketName = "")
        {
            Market mMarket;
            ProductCategoryPageBox mProductCategoryPageBox = new ProductCategoryPageBox();
            ProductType            mProductType            = new ProductType();

            //lay chi tiet ProductType
            //lay danh sach các nhóm sản phẩm con
            //lay cac san pham cua nhom
            mMarket = MarketRepos.getByName(pMarketName.Replace('-', ' '));
            if (mMarket != null)
            {
                mProductCategoryPageBox.List   = new List <ProductCategoryPage>();
                mProductCategoryPageBox.Market = mMarket;
                var mProductTypeList = ProductRepos.getProductTypeParent();
                foreach (ProductType it in mProductTypeList)
                {
                    ProductCategoryPage mProductPage = new ProductCategoryPage();
                    mProductPage.Name  = it.Name;
                    mProductPage.Value = mMarket.UserName;
                    mProductPage.Id    = (int)it.ID;
                    mProductPage.Image = it.Image;
                    List <Product> mProductList = ProductRepos.getByPageSizeMarketId(1, 4, (int)it.ID, mMarket.ID, it.Level);
                    mProductPage.List = mProductList;
                    mProductCategoryPageBox.List.Add(mProductPage);
                }
            }
            return(View("Market", mProductCategoryPageBox));
        }
Beispiel #2
0
        public ActionResult Market(string pMarketName = "")
        {
            V308CMSEntities        mEntities         = new V308CMSEntities();
            ProductRepository      productRepository = new ProductRepository(mEntities);
            MarketRepository       marketRepository  = new MarketRepository(mEntities);
            Market                 mMarket;
            ProductCategoryPageBox mProductCategoryPageBox = new ProductCategoryPageBox();
            ProductType            mProductType            = new ProductType();
            List <ProductType>     mProductTypeList;

            try
            {
                //lay chi tiet ProductType
                //lay danh sach các nhóm sản phẩm con
                //lay cac san pham cua nhom
                mMarket = marketRepository.getByName(pMarketName.Replace('-', ' '));
                if (mMarket != null)
                {
                    mProductCategoryPageBox.List   = new List <ProductCategoryPage>();
                    mProductCategoryPageBox.Market = mMarket;
                    mProductTypeList = productRepository.getProductTypeParent();
                    foreach (ProductType it in mProductTypeList)
                    {
                        ProductCategoryPage mProductPage = new ProductCategoryPage();
                        mProductPage.Name  = it.Name;
                        mProductPage.Value = mMarket.UserName;
                        mProductPage.Id    = (int)it.ID;
                        mProductPage.Image = it.Image;
                        List <Product> mProductList = productRepository.getByPageSizeMarketId(1, 4, (int)it.ID, mMarket.ID, it.Level);
                        mProductPage.List = mProductList;
                        mProductCategoryPageBox.List.Add(mProductPage);
                    }
                }
                return(View(mProductCategoryPageBox));
            }
            catch (Exception ex)
            {
                return(Content(ex.InnerException.ToString()));
            }
            finally
            {
                mEntities.Dispose();
                productRepository.Dispose();
            }
        }