예제 #1
0
        private void LoadCategoryDDL()
        {
            List<SelectListItem> li = new List<SelectListItem>();
            ProductAdminBLL bll = new ProductAdminBLL();
            Dictionary<string, string> list = bll.GetCategory();

            foreach (var item in list)
            {
                li.Add(new SelectListItem { Text = item.Value, Value = item.Key });
            }

            ViewData["Category"] = li;
        }
예제 #2
0
        public void GetSubCategoryDDL()
        {
            
                ProductAdminBLL bll = new ProductAdminBLL();
                Dictionary<string, string> lst = bll.GetCategory();
                List<string> str = new List<string>();
                List<SelectListItem> lstitm = new List<SelectListItem>();
                foreach (var item in lst)
                {
                    lstitm.Add(new SelectListItem { Text = item.Value, Value = item.Key });
                    str.Add(item.Value);
                }

                //ViewBag.ddlSubCategory = new SelectList(lstitm, "Value", "Text");
                ViewBag.SubCategory = new SelectList(lstitm, "Value", "Text").ToList();
           
        }
예제 #3
0
        public ActionResult DeleteCategory(int id)
        {
            Session["ControllerName"] = "Delete Category";
            if (Session["loginDetails"] != null)
            {

                ProductAdminBLL bll = new ProductAdminBLL();
                Dictionary<string, string> dict = bll.GetCategory();
                List<Category> category = new List<Category>();
                foreach (var item in dict)
                {
                    Category cat = new Category();
                    cat.Cat_Id = Convert.ToInt32(item.Key);
                    cat.Cat_Name = item.Value;
                    category.Add(cat);

                }

                Category cate = category.Single(b => b.Cat_Id == id);
                return View(cate);
            }
            else
            {

                return RedirectToAction("Error");
            }

        }