public async Task <IViewComponentResult> InvokeAsync(ICompositeViewComponentContext <MegaMenuEntity> context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var viewModel = await this.megaMenuModel.InitializeViewModel(context.Entity, this.renderContext);

            viewModel.Context = context;

            return(this.View(viewModel));
        }
        public IViewComponentResult Invoke(ICompositeViewComponentContext <StaticSectionEntity> context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            foreach (var child in context.ChildComponents)
            {
                child.Properties.Add("FromParent", "Val from parent");
            }

            var viewModel = new StaticSectionViewModel()
            {
                Context = context
            };

            return(this.View(context.Entity.ViewType ?? "Container", viewModel));
        }
예제 #3
0
        public IViewComponentResult Invoke(ICompositeViewComponentContext <StaticSectionEntity> context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            switch (context.Entity.ViewType)
            {
            case ViewType.Container:
            default:
                return(this.View("Container", context));

            case ViewType.ContainerFluid:
                return(this.View("ContainerFluid", context));

            case ViewType.TwoMixed:
                return(this.View("TwoMixed", context));

            case ViewType.ThreeAutoLayout:
                return(this.View("ThreeAutoLayout", context));
            }
        }