public ActionResult ShowAll()
        {
            var user  = (TMDT.Common.UserLogin)Session[Common.CommonConstants.USER_SESSION];
            var model = new advertisementDAO().GetByIdShop(user.UserID);

            return(View(model));
        }
예제 #2
0
        public ActionResult ListAd(string searchStatus, string searchName, long?searchID, string searchLocation, int page = 1, int pageSize = 10)
        {
            var dao   = new advertisementDAO();
            var model = dao.ListAllPaging(searchStatus, searchName, searchID, searchLocation, page, pageSize);

            ViewBag.ListLocationAd = new LocationAdDAO().GetAll();
            ViewBag.SearchName     = searchName;
            ViewBag.SearchLocation = searchLocation;
            ViewBag.SearchStatus   = searchStatus;
            return(View(model));
        }
예제 #3
0
        public ActionResult EditAd(advertisement ads)
        {
            if (ModelState.IsValid)
            {
                var dao = new advertisementDAO();

                bool update = dao.Update(ads);
                if (update)
                {
                    setAlert("Sửa nội dung quảng cáo thành công", "success");
                    return(RedirectToAction("ListAd", "Advertisement"));
                }
                else
                {
                    ModelState.AddModelError("", "Cập nhật thông tin thất bại");
                }
            }
            return(View("ListAd"));
        }
 public ActionResult Create(advertisement adver)
 {
     if (ModelState.IsValid)
     {
         var merchant   = (Account)Session[Common.CommonConstants.USER_INFO_SESSION];
         var daoAd      = new advertisementDAO();
         var daoOrderAd = new OrderAdvertisementDAO();
         adver.Merchant = merchant.ID;
         adver.CTR      = 0;
         adver.Status   = false;
         var  price = new LocationAdDAO().GetDetail(adver.Location).Price;
         long id    = daoAd.Insert(adver);
         if (id > 0)
         {
             var orderAd = new OrderAdvertisement();
             orderAd.IDAd       = id;
             orderAd.IDmerchant = adver.Merchant;
             orderAd.StartDate  = adver.ActiveDate;
             orderAd.EndDate    = adver.EndDate;
             TimeSpan Days = (TimeSpan)(orderAd.EndDate - orderAd.StartDate);
             orderAd.Price      = Days.Days * price;
             orderAd.Status     = 0;
             orderAd.CreateDate = DateTime.Now;
             long idorder = daoOrderAd.Insert(orderAd);
             if (idorder > 0)
             {
                 return(RedirectToAction("Index", "Advertisment"));
             }
         }
         else
         {
             ModelState.AddModelError("", "Thêm sản phẩm thất bại");
         }
     }
     return(View("Index"));
 }
예제 #5
0
        public ActionResult AdLeftRight()
        {
            var model = new advertisementDAO().GetAvailableSiteAD();

            return(PartialView(model));
        }
예제 #6
0
        public ActionResult EditAd(long id)
        {
            var ads = new advertisementDAO().GetDetail(id);

            return(View(ads));
        }