public JsonResult ListCategory() { Cat = new clsCategory(); var list = new SelectList(Cat.ListCatagory(), "cid", "Category"); return(Json(new { data = list }, JsonRequestBehavior.AllowGet)); }
public ActionResult AddProduct() { Cat = new clsCategory(); ViewBag.Category = Cat.ListCatagory().Select(i => new SelectListItem() { Text = i.CategoryName, Value = i.cid.ToString() }).ToList(); return(View()); }
public ActionResult UpdateProduct(int id) { Prod = new clsProduct(); Cat = new clsCategory(); ViewBag.Category = Cat.ListCatagory().Select(i => new SelectListItem() { Text = i.CategoryName, Value = i.cid.ToString() }).ToList(); return(View(Prod.ProductList().Find(x => x.Pid == id))); }