// GET: Admin/ProductCategory public ActionResult Index(string searchString, int page = 1, int pageSize = 10) { var dao = new ProductCategoryD(); var model = dao.ListAllPaging(searchString, page, pageSize); ViewBag.SearchString = searchString; return(View(model)); }
public JsonResult ChangeStatus(long id) { var result = new ProductCategoryD().ChangeStatus(id); return(Json(new { status = result })); }
public ActionResult Create(ProductCategory productcategory) { if (ModelState.IsValid) { var dao = new ProductCategoryD(); long id = dao.Insert(productcategory); if (id > 0) { SetAlert("Thêm danh mục sản phẩm thành công", "success"); return(RedirectToAction("Index", "ProductCategory")); } else { ModelState.AddModelError("", "Thêm danh mục sản phẩm không thành công"); } } return(View("Index")); }
public ActionResult Edit(ProductCategory productcategory) { if (ModelState.IsValid) { var dao = new ProductCategoryD(); var result = dao.Update(productcategory); if (result) { SetAlert("Cập Nhật danh mục sản phẩm thành công", "success"); return(RedirectToAction("Index", "ProductCategory")); } else { ModelState.AddModelError("", "Cập Nhật danh mục sản phẩm không thành công"); } } return(View("Index")); }
public PartialViewResult ProductCategory() { var model = new ProductCategoryD().ListAll(); return(PartialView(model)); }
public ActionResult Edit(int id) { var productcategory = new ProductCategoryD().ViewDetail(id); return(View(productcategory)); }
public void SetViewBag(long?selectedId = null) { var dao = new ProductCategoryD(); ViewBag.CategoryID = new SelectList(dao.ListAll(), "ID", "Name", selectedId); }