public ActionResult Index()
        {
            var definition = RouteData.DataTokens["Definition"] as ICustomEntityDefinition;

            var options = new CustomEntityModuleOptions()
            {
                CustomEntityDefinitionCode = definition.CustomEntityDefinitionCode,
                ForceUrlSlugUniqueness     = definition.ForceUrlSlugUniqueness,
                HasLocale           = definition.HasLocale,
                AutoGenerateUrlSlug = definition.AutoGenerateUrlSlug,
                AutoPublish         = definition.AutoPublish,
                Name         = definition.NamePlural,
                NameSingular = definition.Name,
                Terms        = definition.GetTerms()
            };

            if (definition is IOrderableCustomEntityDefinition)
            {
                options.Ordering = ((IOrderableCustomEntityDefinition)definition).Ordering;
            }

            var viewPath = ViewPathFormatter.View("CustomEntities", nameof(Index));

            return(View(viewPath, options));
        }
Example #2
0
        public ActionResult Index(ICustomEntityDefinition definition)
        {
            var options = new CustomEntityModuleOptions()
            {
                CustomEntityDefinitionCode = definition.CustomEntityDefinitionCode,
                ForceUrlSlugUniqueness     = definition.ForceUrlSlugUniqueness,
                HasLocale           = definition.HasLocale,
                AutoGenerateUrlSlug = definition.AutoGenerateUrlSlug,
                AutoPublish         = definition.AutoPublish,
                Name         = definition.NamePlural,
                NameSingular = definition.Name,
                Terms        = definition.GetTerms()
            };

            if (definition is IOrderableCustomEntityDefinition)
            {
                options.Ordering = ((IOrderableCustomEntityDefinition)definition).Ordering;
            }

            return(View("~/Admin/Modules/CustomEntities/Mvc/Views/Index.cshtml", options));
        }