public ActionResult AddProduct() { if (Session["UserID"] == null) { return(RedirectToAction("AdminLogin", "AdminLogin")); } else { ProductViewModel pwm = new ProductViewModel(); List <SelectListItem> CatList = new List <SelectListItem>(); List <SelectListItem> BrandList = new List <SelectListItem>(); foreach (Category item in cr.List().ProcessResult) { CatList.Add(new SelectListItem { Value = item.CategoryId.ToString(), Text = item.CategoryName }); } foreach (Brand item in br.List().ProcessResult) { BrandList.Add(new SelectListItem { Value = item.BrandId.ToString(), Text = item.BrandName }); } pwm.BrandList = BrandList; pwm.CategoryList = CatList; pwm.Product = null; return(View(pwm)); } }
// GET: Admin/Brand public ActionResult List() { if (Session["UserID"] == null) { return(RedirectToAction("AdminLogin", "AdminLogin")); } else { result.resultList = br.List(); return(View(result.resultList.ProcessResult)); } }
// GET: Admin/Brand public ActionResult List(string message, int?id) { result.resultList = br.List(); if (message != null) { ViewBag.Message = String.Format("{0} nolu markanın silme islemi {1}", id, message); } else { ViewBag.Message = ""; } return(View(result.resultList.ProccessResult)); }
public ActionResult AddProduct() { ProductViewModel pwm = new ProductViewModel(); List <SelectListItem> CatList = new List <SelectListItem>(); List <SelectListItem> BrandList = new List <SelectListItem>(); foreach (Category item in cr.List().ProcessResult) { CatList.Add(new SelectListItem { Value = item.CategoryId.ToString(), Text = item.CategoryName }); } foreach (Brand item in br.List().ProcessResult) { BrandList.Add(new SelectListItem { Value = item.BrandId.ToString(), Text = item.BrandName }); } pwm.BrandList = BrandList; pwm.CategoryList = CatList; pwm.Product = null; return(View(pwm)); }
//edit ve add sayfasında product a göre combobox üzerinde brand ve category gösterimi public void BrandCatList(List <SelectListItem> cat, List <SelectListItem> brand, Guid c, int b) { foreach (Category item in cr.List().ProccessResult) { cat.Add(new SelectListItem { Value = item.CategoryID.ToString(), Text = item.CategoryName, Selected = (item.CategoryID == c)?true:false, }); } foreach (Brand item in br.List().ProccessResult) { brand.Add(new SelectListItem { Value = item.BrandID.ToString(), Text = item.BrandName, Selected = (item.BrandID == b)?true:false, }); } }
public ActionResult List() { result.resultList = br.List(); return(View(result.resultList.ProcessResult)); }