Ejemplo n.º 1
0
        // 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);
 }
Ejemplo n.º 3
0
        public JsonResult ChangeStatus(long id)
        {
            var result = new AdDAO().ChangeStatus(id);

            return(Json(new
            {
                status = result
            }));
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        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"));
        }
Ejemplo n.º 6
0
        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"));
        }
Ejemplo n.º 7
0
        public ActionResult Edit(int id)
        {
            var slide = new AdDAO().ViewDetail(id);

            return(View(slide));
        }
Ejemplo n.º 8
0
 public HomeController()
 {
     postDAO = new ClientPostDAO(db);
     adDAO   = new AdDAO(db);
 }
Ejemplo n.º 9
0
 public AdController()
 {
     adDAO = new AdDAO(db);
 }