public ActionResult Brand(int page = 1) { Session["ControllerName"] = "Brand"; if (Session["loginDetails"] != null) { int pageSize = 10; int totalPage = 0; int totalRecord = 0; List<Brand> lst = new List<BLL.Brand>(); ProductAdminBLL bll = new ProductAdminBLL(); totalRecord = bll.GetBrands().Count(); totalPage = (totalRecord / pageSize) + ((totalRecord % pageSize) > 0 ? 1 : 0); lst = bll.GetBrands().OrderBy(a => a.Brand_Name).Skip(((page - 1) * pageSize)).Take(pageSize).ToList(); //List<Brand> lst = bll.GetBrands(); ViewBag.TotalRows = totalRecord; ViewBag.PageSize = pageSize; return View(lst); } else { return RedirectToAction("Error"); } }
public ActionResult DeleteBrand(int id) { Session["ControllerName"] = "Delete Brand"; if (Session["loginDetails"] != null) { ProductAdminBLL bll = new ProductAdminBLL(); Brand brand = bll.GetBrands().ToList().Single(b => b.Brand_Id == id); //bll.Employees.Single(emp => emp.ID == id); return View(brand); } else { return RedirectToAction("Error"); } }
public void getDdlsForProduct() { ProductAdminBLL bll = new ProductAdminBLL(); // Dictionary<string, string> lst = bll.GetSubcategory(); // 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); // } // ddlSubCategory = lstitm; // //ViewBag.ddlSubCategory = new SelectList(lstitm, "Value", "Text"); //// ViewBag.SubCategory = new SelectList(lstitm, "Value", "Text").ToList(); lstitm = new List<SelectListItem>(); List<Brand> lstbrand = bll.GetBrands(); Dictionary<string, string> lstbrands = new Dictionary<string, string>(); foreach (Brand item in lstbrand) { lstitm.Add(new SelectListItem { Text = item.Brand_Name, Value =Convert.ToString(item.Brand_Id) }); } ddlbrand = lstitm; ViewBag.DDLBrand = lstbrand; }