public static HelperResult RenderIfHasPermission(this HtmlHelper htmlHelper, string actionName, string controllerName, string areaName, Func<SecurityTrimmingHelper, HelperResult> template) { using (var helper = new SecurityTrimmingHelper(htmlHelper, actionName, controllerName, areaName)) { return helper.HasPermission ? template(helper) : new HelperResult(writer => { }); } }
public static HelperResult RenderIfHasPermission(this HtmlHelper htmlHelper, string actionName, string controllerName, string areaName, Func <SecurityTrimmingHelper, HelperResult> template) { using (var helper = new SecurityTrimmingHelper(htmlHelper, actionName, controllerName, areaName)) { return(helper.HasPermission ? template(helper) : new HelperResult(writer => { })); } }