public ActionResult DeleteSubCategory(int id) { Session["ControllerName"] = "Delete SubCategory"; if (Session["loginDetails"] != null) { ProductAdminBLL bll = new ProductAdminBLL(); //bll.GetSubcategory().ToList().Single(b => b.Brand_Id == id); SubCategoryDetails det = bll.getAllSubCategory().ToList().Single(b => b.Sub_Cat_Id == id); return View(det); } else { return RedirectToAction("Error"); } }
public ActionResult SubCategory(int page = 1) { Session["ControllerName"] = "Sub Category"; if (Session["loginDetails"] != null) { int pageSize = 10; int totalPage = 0; int totalRecord = 0; List<SubCategoryDetails> sub = new List<BLL.SubCategoryDetails>(); ProductAdminBLL bll = new ProductAdminBLL(); totalRecord = bll.getAllSubCategory().Count(); totalPage = (totalRecord / pageSize) + ((totalRecord % pageSize) > 0 ? 1 : 0); sub = bll.getAllSubCategory().OrderBy(a => a.Sub_Cat_Name).Skip(((page - 1) * pageSize)).Take(pageSize).ToList(); ViewBag.TotalRows = totalRecord; ViewBag.PageSize = pageSize; return View(sub); } else { return RedirectToAction("Error"); } }
public ActionResult EditSubCategory(int id) { Session["ControllerName"] = "Edit SubCategory"; if (Session["loginDetails"] != null) { ProductAdminBLL bll = new ProductAdminBLL(); List<SubCategoryDetails> list = bll.getAllSubCategory(); //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); //} GetSubCategoryDDL(); SubCategoryDetails cate = list.Single(b => b.Sub_Cat_Id == id); return View(cate); } else { return RedirectToAction("Error"); } }