Пример #1
0
        public string GetComponentName()
        {
            var component = ControllerContext.RequestContext.RouteData
                            ?.Values[ComponentConstants.ComponentKey]
                            ?.ToString();

            return(string.IsNullOrEmpty(component)
                ? ControllerContext.ExecutingViewName()
                : Regex.Replace(component, "component$", string.Empty, RegexOptions.IgnoreCase));
        }
Пример #2
0
        public static PartialViewResult GetPartialView(this ViewEngineResult engineView,
                                                       ControllerContext context,
                                                       object model = null)
        {
            context.SetViewEngineModel(model);

            return(new PartialViewResult
            {
                ViewName = context.ExecutingViewName(),
                ViewData = context.Controller.ViewData,
                TempData = context.Controller.TempData
            });
        }