public ActionResult Edit(int id) { var account = new CategoriesDao().CategoryDetail(id); SetViewBag(); return(View(account)); }
// GET: Admin/Category public ActionResult Index() { SetUserGroupViewBag(); SetViewBag(); SetStatusViewBag(); var dao = new CategoriesDao(); var listCategory = dao.ListAll(); return(View(listCategory)); }
// GET: Admin/Category public ActionResult Index() { SetUserGroupViewBag(); SetViewBag(); SetStatusViewBag(); SetAlert("Load thành công", "success"); var dao = new CategoriesDao(); var listCategory = dao.ListAll(); return(View(listCategory)); }
public ActionResult Edit(Category tag) { SetViewBag(); var dao = new CategoriesDao(); var model = dao.ListAll(); if (ModelState.IsValid) { var result = dao.Update(tag); if (result) { return(RedirectToAction("Index", "Category", model)); } else { ModelState.AddModelError("", "Cập nhật không thành công"); } } return(View("Edit")); }
public ActionResult Create(Category tag) { SetViewBag(); var dao = new CategoriesDao(); var result = dao.ListAll(); if (ModelState.IsValid) { long id = dao.Insert(tag); if (id > 0) { // chuyển hướng trang về admin/User/index return(RedirectToAction("Index", "Category", result)); } else { ModelState.AddModelError("", "Thêm danh muc không thành công"); } } return(View("Create")); }
// GET: Admin/Categories public ActionResult Index() { CategoriesDao dao = new CategoriesDao(); return(View(dao.ListCategories())); }
public void SetViewBag(int?selectedid = null) { var dao1 = new CategoriesDao(); ViewBag.ParentID = new SelectList(dao1.ListAll(), "ID", "Name", selectedid); }
public void SetViewBagCategory(long?selectedId = null) { var dao = new CategoriesDao(); ViewBag.CategoryID = dao.ListAll(); }
public void SetViewBag(long?selectedId = null) { var dao = new CategoriesDao(); ViewBag.CategoryID = new SelectList(dao.ListAll(), "ID", "Name", selectedId); }
public void SetViewBagCategory(int?selected = null) { var daoC = new CategoriesDao(); ViewData["CategoryID"] = new SelectList(daoC.ListAll(), "ID", "Name", selected); }