// GET: Admin/Ad public ActionResult Index(string searchString, int page = 1, int pageSize = 10) { var DAO = new AdDAO(); var model = DAO.ListAllAd(searchString, page, pageSize); ViewBag.SearchString = searchString; return(View(model)); }
public CommonController() { postCategoryDAO = new PostCategoryDAO(db); menuDAO = new MenuDAO(db); postDAO = new PostDAO(db); systemInfoDAO = new SystemInfoDAO(db); adDAO = new AdDAO(db); }
public JsonResult ChangeStatus(long id) { var result = new AdDAO().ChangeStatus(id); return(Json(new { status = result })); }
public ActionResult _Ads(long?idc) { var DAOAds = new AdDAO(); List <Ad> listAds = DAOAds.ListAll(); List <Ad> listAd = new List <Ad>(); if (idc != 0 && idc != 1) { Ad ad = new Ad(); ad.Image = listAds[(int)((int)idc - 2)].Image; listAd.Add(ad); } return(PartialView(listAd)); }
public ActionResult Edit(Ad ads) { if (ModelState.IsValid) { var DAO = new AdDAO(); var result = DAO.Update(ads); if (result) { SetAlert("Cập nhật thành công", "success"); return(RedirectToAction("Index", "Ad")); } else { SetAlert("Cập nhật thất bại", "error"); ModelState.AddModelError("", "Cập nhật thất bại"); } } return(View("Index")); }
public ActionResult Create(Ad ads) { if (ModelState.IsValid) { var DAO = new AdDAO(); long id = DAO.Insert(ads); if (id > 0) { SetAlert("Thêm thành công", "success"); return(RedirectToAction("Index", "Ad")); } else { SetAlert("Thêm thất bại", "error"); ModelState.AddModelError("", "Thêm thất bại"); } } return(View("Index")); }
public ActionResult Edit(int id) { var slide = new AdDAO().ViewDetail(id); return(View(slide)); }
public HomeController() { postDAO = new ClientPostDAO(db); adDAO = new AdDAO(db); }
public AdController() { adDAO = new AdDAO(db); }