Esempio n. 1
0
        public ActionResult showProduct()
        {
            ViewBag.userName = Session["userName"];
            ViewBag.logged   = Session["LoggedIN"];
            if (Request.Form["submitButton"] != null)
            {
                ViewBag.CategoryName = category.Get(Convert.ToInt32(Request.Form["categoryDropDown"])).Category_Name;
                IEnumerable <Product>  pro         = product.GetByCategory(Convert.ToInt32(Request.Form["categoryDropDown"]));
                List <ProductCategory> proFullList = new List <ProductCategory>();

                foreach (Product p in pro)
                {
                    ProductCategory proFull = new ProductCategory();
                    proFull.productID              = p.Id;
                    proFull.productName            = p.Product_Name;
                    proFull.productCategoryName    = category.Get(Convert.ToInt32(Request.Form["categoryDropDown"])).Category_Name;
                    proFull.productSubCategoryName = subCategory.Get(p.Sub_Category_ID).Sub_Category_Name;
                    proFull.productPrice           = p.Product_Price;
                    proFull.productQuantity        = p.Product_Quantity;
                    proFull.productPicture         = p.Product_Picture;
                    proFull.productAbout           = p.Product_About;

                    proFullList.Add(proFull);
                }
                ViewBag.check = Request.Form["categoryDropDown"];
                return(View(proFullList));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult Index(int cat)
        {
            ViewBag.userName = Session["userName"];
            ViewBag.logged   = Session["LoggedIN"];

            iCategory_Service category = Service_Center.GetCategory_Service();

            @ViewBag.CategoryName = category.Get(cat).Category_Name;
            return(View(product.GetByCategory(cat)));
        }