Esempio n. 1
0
        public IViewComponentResult Invoke()
        {
            var notification = _pageRepository.Pages().Where(x => x.Status == true).FirstOrDefault();
            var slides       = new List <Slide>();

            if (!_cache.TryGetValue("slide", out slides))
            {
                if (slides == null)
                {
                    slides = _slideRepository.Slides().
                             Where(x => x.Status == true).
                             OrderBy(x => x.DisplayOrder)
                             .ToList();
                }
                var cacheEntryOptions = new MemoryCacheEntryOptions()
                                        .SetSlidingExpiration(TimeSpan.FromMinutes(10));

                _cache.Set("slide", slides);
            }
            var bannerViewModel = new BannerViewModels
            {
                Notification = notification,
                Slides       = slides
            };

            return(View(bannerViewModel));
        }
Esempio n. 2
0
 public async Task <ActionResult> EditBanner(BannerViewModels model)
 {
     if (ModelState.IsValid)
     {
         MediaContent MainObj = cms_db.GetObjMediaContent(model.MediaContentId);
         if (MainObj != null)
         {
             MainObj.Filename        = model.Filename;
             MainObj.AlternativeText = model.AlternativeText;
             MainObj.Caption         = model.Caption;
             MainObj.EXIFInfo        = model.EXIFInfo;
             MainObj.MediaDesc       = model.MediaDesc;
             MainObj.MetadataDesc    = model.MetadataDesc;
             MainObj.LinkHref        = model.LinkHref;
             MainObj.MetadataKeyword = model.MetadataKeyword;
             int rs = await cms_db.UpdateMediaContent(MainObj);
         }
         return(RedirectToAction("BannerManager"));
     }
     return(RedirectToAction("BannerManager"));
 }
Esempio n. 3
0
 public async Task <ActionResult> CreateBanner(BannerViewModels model)
 {
     if (ModelState.IsValid)
     {
         MediaContent MainObj = cms_db.GetObjMediaContent(model.ImgdefaultId);
         if (MainObj != null)
         {
             MainObj.Filename        = model.Filename;
             MainObj.CrtdUID         = long.Parse(User.Identity.GetUserId());
             MainObj.CrtdDT          = DateTime.Now;
             MainObj.AlternativeText = model.AlternativeText;
             MainObj.Caption         = model.Caption;
             MainObj.EXIFInfo        = model.EXIFInfo;
             MainObj.MediaDesc       = model.MediaDesc;
             MainObj.MetadataDesc    = model.MetadataDesc;
             MainObj.MetadataKeyword = model.MetadataKeyword;
             MainObj.LinkHref        = model.LinkHref;
             MainObj.ObjTypeId       = (int)EnumCore.ObjTypeId.banner;
             int rs = await cms_db.UpdateMediaContent(MainObj);
         }
         return(RedirectToAction("BannerManager"));
     }
     return(RedirectToAction("BannerManager"));
 }
Esempio n. 4
0
        public ActionResult EditBanner(long id)
        {
            BannerViewModels model = new BannerViewModels(cms_db.GetObjMediaContent(id));

            return(View(model));
        }
Esempio n. 5
0
        public ActionResult CreateBanner()
        {
            BannerViewModels model = new BannerViewModels();

            return(View(model));
        }