Пример #1
0
        public ActionResult Index()
        {
            ViewBag.Total = PostService.Count(p => p.Status == Status.Pended || CurrentUser.IsAdmin);
            var banners    = BannerService.GetAllFromCache().OrderBy(b => new Random().Next()).ToList();
            var fastShares = FastShareService.GetAllFromCache(s => s.Sort).ToList();

            ViewBag.FastShare = fastShares;
            var viewModel = GetIndexPageViewModel(1, 15, OrderBy.ModifyDate, CurrentUser);

            viewModel.Banner = banners;
            return(View(viewModel));
        }
Пример #2
0
        public ActionResult Index(OrderBy orderBy = OrderBy.ModifyDate)
        {
            ViewBag.Total = PostService.Count(p => p.Status == Status.Pended);
            UserInfoOutputDto user      = HttpContext.Session.Get <UserInfoOutputDto>(SessionKey.UserInfo) ?? new UserInfoOutputDto();
            var banners                 = BannerService.GetAllFromL2CacheNoTracking(b => new Random().Next()).ToList();
            List <FastShare> fastShares = FastShareService.GetAllFromL2CacheNoTracking(s => s.Sort).ToList();

            ViewBag.FastShare = fastShares;
            var viewModel = GetIndexPageViewModel(1, 15, orderBy, user);

            viewModel.Banner = banners;
            return(View(viewModel));
        }