public static bool IsUmbraco8(this RazorPage view)
        {
#if NETFRAMEWORK
            return(true);
#else
            return(false);
#endif
        }
        public static TService GetService <TService>(this RazorPage view)
        {
#if NETFRAMEWORK
            return((TService)Current.Factory.GetInstance(typeof(TService)));
#else
            return((TService)view.Context.RequestServices.GetService(typeof(TService)));
#endif
        }
        public static T GetSettings <T>(this RazorPage view)
            where T : class
        {
#if NETFRAMEWORK
            return(view.GetService <T>());
#else
            return(view.GetService <IOptions <T> >()?.Value);
#endif
        }
Пример #4
0
 public static Tag A <T>(this System.Web.Mvc.WebViewPage <T> page, string href, string name = "")
 {
     return(new Tag("a").Attr("href", href).Name(name));
 }
Пример #5
0
 public static JsTag Scr <T>(this System.Web.Mvc.WebViewPage <T> page, string src)
 {
     return(new JsTag(src));
 }
Пример #6
0
 public static Tag Tag <T>(this System.Web.Mvc.WebViewPage page, string tagName, object attributes = null)
 {
     return(new Tag(tagName, attributes));
 }