Exemplo n.º 1
0
        public ActionResult Index(int id = 0)
        {
            IQueryable <IUser> users = CacheController.GetUsers(_bl);
            int elementsPerPage      = 5;
            int page = GetPageNumber(id, elementsPerPage, users.Count());

            ViewBag.AdminUserControllerPage = page;
            return(View(_bl.GetUserList().Skip(page * elementsPerPage).Take(elementsPerPage)));
        }
 public static IQueryable <IUser> GetUsers(MyIBL ibl)
 {
     lock (typeof(CacheController))
     {
         IQueryable <IUser> users = (IQueryable <IUser>)HttpRuntime.Cache["Users"];
         if (users == null)
         {
             users = ibl.GetUserList();
             HttpRuntime.Cache.Insert("Users", users);
         }
         return(users);
     }
 }
        public static void UpdateUsers(MyIBL ibl)
        {
            IQueryable <IUser> users = ibl.GetUserList();

            HttpRuntime.Cache.Insert("Users", users);
        }