public ActionResult Edit(long id) { var dao = new ContentD(); var content = dao.GetByID(id); SetViewBag(content.CategoryID); return(View()); }
// GET: Admin/Content/ public ActionResult Index(string searchString, int page = 1, int pageSize = 10) { var dao = new ContentD(); var model = dao.ListAllPaging(searchString, page, pageSize); ViewBag.SearchString = searchString; return(View(model)); }
public JsonResult ChangeStatus(long id) { var result = new ContentD().ChangeStatus(id); return(Json(new { status = result })); }
public ActionResult Create(Content content) { if (ModelState.IsValid) { var dao = new ContentD(); long id = dao.Insert(content); if (id > 0) { SetAlert("Thêm tin tức thành công", "success"); return(RedirectToAction("Index", "Content")); } else { ModelState.AddModelError("", "Thêm Content không thành công"); } } SetViewBag(content.CategoryID); return(View("Index")); }
public ActionResult Edit(Content content) { if (ModelState.IsValid) { var dao = new ContentD(); var result = dao.Update(content); if (result) { SetAlert("Cập Nhật tin tức thành công", "success"); return(RedirectToAction("Index", "Content")); } else { ModelState.AddModelError("", "Cập Nhật không thành công"); } } SetViewBag(content.CategoryID); return(View()); }