Beispiel #1
0
        public ActionResult Ads(FormCollection collection)
        {
            _9d_ad ad = accountContext._9d_ads.Where(c => c.ads_type == Convert.ToInt32(collection["MovieType"].ToString())).FirstOrDefault();

            if (ad != null)
            {
                if (collection["adstitle"].ToString() != "")
                {
                    ad.ads_name = collection["adstitle"].ToString();
                }
                if (collection["adslink"].ToString() != "")
                {
                    ad.ads_link = collection["adslink"].ToString();
                }
                if (collection["adsimage"].ToString() != "")
                {
                    ad.ads_image = collection["adsimage"].ToString();
                }
                try
                {
                    accountContext.SubmitChanges();
                    TempData["successads"] = "Cập nhật quảng cáo thành công.";
                    return(View());
                }
                catch (Exception)
                {
                    TempData["errorads"] = "Có lỗi vui lòng kiểm tra lại";
                    return(View());
                }
            }
            return(View());
        }
Beispiel #2
0
        //
        // GET: /Home/

        public ActionResult Index()
        {
            List <_9d_new> listNews  = accountContext._9d_news.Where(c => c.delete_flag == false).OrderByDescending(c => c.created_at).ToList();
            _9d_ad         indexleft = accountContext._9d_ads.Where(c => c.ads_type == 1).FirstOrDefault();

            if (indexleft != null)
            {
                ViewBag.indexleftlink  = indexleft.ads_link;
                ViewBag.indexleftimage = indexleft.ads_image;
                ViewBag.indexleftname  = indexleft.ads_name;
            }
            else
            {
                ViewBag.indexleftlink  = "/";
                ViewBag.indexleftimage = "../Content/images/left-banner.png";
                ViewBag.indexleftname  = "Không có sự kiện";
            }

            _9d_ad indexright = accountContext._9d_ads.Where(c => c.ads_type == 2).FirstOrDefault();

            if (indexleft != null)
            {
                ViewBag.indexrightlink  = indexright.ads_link;
                ViewBag.indexrightimage = indexright.ads_image;
                ViewBag.indexrightname  = indexright.ads_name;
            }
            else
            {
                ViewBag.indexleft = "/";
                ViewBag.indexleft = "../Content/images/right-banner.png";
                ViewBag.indexleft = "Không có sự kiện";
            }
            return(View(listNews));
        }
Beispiel #3
0
        public ActionResult Banner()
        {
            _9d_ad right = accountContext._9d_ads.Where(c => c.ads_type == 3).FirstOrDefault();

            if (right != null)
            {
                ViewBag.rightlink  = right.ads_link;
                ViewBag.rightimage = right.ads_image;
                ViewBag.rightname  = right.ads_name;
            }
            else
            {
                ViewBag.rightlink  = "/";
                ViewBag.rightimage = "../Content/images/bottom-banner.png";
                ViewBag.rightname  = "Không có sự kiện";
            }
            return(PartialView("Banner"));
        }