// GET: Admin/Content public ActionResult Index(string searchString, int page = 1, int pageSize = 10) { var dao = new ContentDao(); var model = dao.listAllPaging(searchString, page, pageSize); ViewBag.SearchString = searchString; return View(model); }
public ActionResult Detail(long id) { var model = new ContentDao().GetByID(id); ViewBag.Tags = new ContentDao().ListTag(id); return View(model); }
public ActionResult Edit(long id) { var dao = new ContentDao(); var content = dao.GetByID(id); SetViewBag(content.CategoryID); return View(content); }
// GET: Admin/Content public ActionResult Index(string searchString, int page = 1, int pageSize = 10,int catId=1) { var dao = new ContentDao(); var model = dao.ListAllPaging(searchString, page, pageSize,catId); SetViewBag(catId); ViewBag.SearchString = searchString; return View(model); }
public JsonResult ChangeStatus(long id) { var result = new ContentDao().ChangeStatus(id); return Json(new { status = result }); }
// GET: Home public ActionResult Index() { ViewBag.Slides = new SlideDao().ListAll(); var productDao = new ProductDao(); var contentDao = new ContentDao(); ViewBag.NewProducts = productDao.ListNewProduct(4); ViewBag.ListFeatureProducts = productDao.ListFeatureProduct(4); ViewBag.ListNewsEvent = contentDao.ListNewsEvent(4); return View(); }
public ActionResult Edit(long id) { //lấy ra ID từ content var dao = new Model.Dao.ContentDao(); var content = dao.GetById(id); //gán setviewbag đưa ra create SetViewBag(content.CategoryID); return(View()); }
public ActionResult Edit(Content model) { if (ModelState.IsValid) { var dao = new ContentDao(); var result = dao.Update(model); return RedirectToAction("Index"); } SetViewBag(model.CategoryID); return View(); }
// GET: Content public ActionResult Index(int page = 1, int pageSize = 10) { var model = new ContentDao().ListAllPaging(page, pageSize); int totalRecord = 0; ViewBag.Total = totalRecord; ViewBag.Page = page; int maxPage = 5; int totalPage = 0; totalPage = (int)Math.Ceiling((double)(totalRecord / pageSize)); ViewBag.TotalPage = totalPage; ViewBag.MaxPage = maxPage; ViewBag.First = 1; ViewBag.Last = totalPage; ViewBag.Next = page + 1; ViewBag.Prev = page - 1; return View(model); }
public ActionResult Edit(Content content) { var dao = new ContentDao(); if (ModelState.IsValid) { var session = (UserLogin)Session[CommonConstants.USER_SESSION]; content.ModifiedBy = session.UserName; var culture = Session[CommonConstants.CurrentCulture]; content.Language = culture.ToString(); var result = dao.Edit(content); if (result) { SetAlert("Cập nhật tin tức thành công!", "success"); return RedirectToAction("Index"); } else { ModelState.AddModelError("", "Cập nhật tin tức không thành công!"); } return RedirectToAction("Index"); } SetViewBag(content.CategoryID); return View(); }
public void SetViewBag(long?seletedID = null) { var dao = new Model.Dao.ContentDao(); ViewBag.Content_Category_ID = new SelectList(dao.ListAllContentCategory(), "ID", "Name", seletedID); }