コード例 #1
0
        public ActionResult CachedPartialExampleByID(int ID)
        {
            // Get the Item, the cache dependency keys will be added automatically to the output cache
            var Item = mExampleModuleClassRepo.GetExampleModuleClass(ID);

            // Convert to View Model
            var Model = new ExampleModuleClassViewModel()
            {
                Name = Item.Name
            };

            // Return the item
            return(View("CachedPartialExample", Model));
        }
コード例 #2
0
        public ActionResult CachedPartialExample(int Index)
        {
            // Get the Items, the cache dependency keys will be added automatically to the output cache
            var Items = mExampleModuleClassRepo.GetExampleModuleClasses();

            // Convert to View Model
            if (Items.Count() >= Index)
            {
                var Model = new ExampleModuleClassViewModel()
                {
                    Name = Items.ToList()[Index - 1].Name
                };
                return(View("CachedPartialExample", Model));
            }
            else
            {
                return(Content(""));
            }
        }
コード例 #3
0
        public ActionResult CachedPartialExample_BaseInfo(int Index)
        {
            // Get the BaseInfo models
            var Items = mExampleModuleClassRepo.GetExampleModuleClasses_BaseInfo();

            // Add cache dependency
            mOutputCacheDependencies.AddDependencyOnInfoObjects <ExampleModuleClassInfo>();

            if (Items.Count() >= Index)
            {
                // Convert to View Model
                var Model = new ExampleModuleClassViewModel()
                {
                    Name = Items.First().ExampleModuleClassName
                };

                return(View("CachedPartialExample", Model));
            }
            else
            {
                return(Content(""));
            }
        }